Adjust struct/class alignment

This commit is contained in:
Tatsuhiro Tsujikawa 2013-12-06 23:17:38 +09:00
parent 58dd118c89
commit 6ea91e57e0
30 changed files with 337 additions and 333 deletions

View File

@ -64,8 +64,9 @@ struct Connection {
}; };
struct Request { struct Request {
/* The gzip stream inflater for the compressed response. */
nghttp2_gzip *inflater;
char *host; char *host;
uint16_t port;
/* In this program, path contains query component as well. */ /* In this program, path contains query component as well. */
char *path; char *path;
/* This is the concatenation of host and port with ":" in /* This is the concatenation of host and port with ":" in
@ -73,19 +74,18 @@ struct Request {
char *hostport; char *hostport;
/* Stream ID for this request. */ /* Stream ID for this request. */
int32_t stream_id; int32_t stream_id;
/* The gzip stream inflater for the compressed response. */ uint16_t port;
nghttp2_gzip *inflater;
}; };
struct URI { struct URI {
const char *host; const char *host;
size_t hostlen;
uint16_t port;
/* In this program, path contains query component as well. */ /* In this program, path contains query component as well. */
const char *path; const char *path;
size_t pathlen; size_t pathlen;
const char *hostport; const char *hostport;
size_t hostlen;
size_t hostportlen; size_t hostportlen;
uint16_t port;
}; };
/* /*

View File

@ -38,9 +38,9 @@
#include "comp_helper.h" #include "comp_helper.h"
typedef struct { typedef struct {
nghttp2_hd_side side;
size_t table_size; size_t table_size;
size_t deflate_table_size; size_t deflate_table_size;
nghttp2_hd_side side;
int http1text; int http1text;
int dump_header_table; int dump_header_table;
int no_refset; int no_refset;

View File

@ -38,8 +38,8 @@
#include "comp_helper.h" #include "comp_helper.h"
typedef struct { typedef struct {
nghttp2_hd_side side;
size_t table_size; size_t table_size;
nghttp2_hd_side side;
int dump_header_table; int dump_header_table;
} inflate_config; } inflate_config;

View File

@ -616,10 +616,6 @@ typedef struct {
* The frame header. * The frame header.
*/ */
nghttp2_frame_hd hd; nghttp2_frame_hd hd;
/**
* The priority.
*/
int32_t pri;
/** /**
* The name/value pairs. * The name/value pairs.
*/ */
@ -628,6 +624,10 @@ typedef struct {
* The number of name/value pairs in |nva|. * The number of name/value pairs in |nva|.
*/ */
size_t nvlen; size_t nvlen;
/**
* The priority.
*/
int32_t pri;
nghttp2_headers_category cat; nghttp2_headers_category cat;
} nghttp2_headers; } nghttp2_headers;
@ -704,10 +704,6 @@ typedef struct {
* The frame header. * The frame header.
*/ */
nghttp2_frame_hd hd; nghttp2_frame_hd hd;
/**
* The promised stream ID
*/
int32_t promised_stream_id;
/** /**
* The name/value pairs. * The name/value pairs.
*/ */
@ -716,6 +712,10 @@ typedef struct {
* The number of name/value pairs in |nva|. * The number of name/value pairs in |nva|.
*/ */
size_t nvlen; size_t nvlen;
/**
* The promised stream ID
*/
int32_t promised_stream_id;
} nghttp2_push_promise; } nghttp2_push_promise;
/** /**
@ -1282,6 +1282,10 @@ typedef enum {
* Struct to store option values for nghttp2_session. * Struct to store option values for nghttp2_session.
*/ */
typedef struct { typedef struct {
/**
* :enum:`NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS`
*/
uint32_t peer_max_concurrent_streams;
/** /**
* :enum:`NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE` * :enum:`NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE`
*/ */
@ -1290,10 +1294,6 @@ typedef struct {
* :enum:`NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE` * :enum:`NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE`
*/ */
uint8_t no_auto_connection_window_update; uint8_t no_auto_connection_window_update;
/**
* :enum:`NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS`
*/
uint32_t peer_max_concurrent_streams;
} nghttp2_opt_set; } nghttp2_opt_set;
/** /**

View File

@ -66,16 +66,16 @@ typedef enum {
*/ */
typedef struct { typedef struct {
nghttp2_frame_hd hd; nghttp2_frame_hd hd;
/**
* The data to be sent for this DATA frame.
*/
nghttp2_data_provider data_prd;
/** /**
* The flag to indicate whether EOF was reached or not. Initially * The flag to indicate whether EOF was reached or not. Initially
* |eof| is 0. It becomes 1 after all data were read. This is used * |eof| is 0. It becomes 1 after all data were read. This is used
* exclusively by nghttp2 library and not in the spec. * exclusively by nghttp2 library and not in the spec.
*/ */
uint8_t eof; uint8_t eof;
/**
* The data to be sent for this DATA frame.
*/
nghttp2_data_provider data_prd;
} nghttp2_data; } nghttp2_data;
int nghttp2_frame_is_data_frame(uint8_t *head); int nghttp2_frame_is_data_frame(uint8_t *head);

View File

@ -118,13 +118,24 @@ typedef struct {
size_t deflate_hd_table_bufsize_max; size_t deflate_hd_table_bufsize_max;
/* The number of effective entry in |hd_table|. */ /* The number of effective entry in |hd_table|. */
size_t deflate_hd_tablelen; size_t deflate_hd_tablelen;
/* The number of entry the |buf_track| contains. */
size_t buf_tracklen;
/* Holding emitted entry in deflating header block to retain /* Holding emitted entry in deflating header block to retain
reference count. */ reference count. */
nghttp2_hd_entry **emit_set; nghttp2_hd_entry **emit_set;
/* Keep track of allocated buffers in inflation */
uint8_t **buf_track;
/* Role of this context; deflate or infalte */
nghttp2_hd_role role;
/* NGHTTP2_HD_SIDE_REQUEST for processing request, otherwise
response. */
nghttp2_hd_side side;
/* The capacity of the |emit_set| */ /* The capacity of the |emit_set| */
uint16_t emit_set_capacity; uint16_t emit_set_capacity;
/* The number of entry the |emit_set| contains */ /* The number of entry the |emit_set| contains */
uint16_t emit_setlen; uint16_t emit_setlen;
/* The capacity of |buf_track| */
uint16_t buf_track_capacity;
/* If inflate/deflate error occurred, this value is set to 1 and /* If inflate/deflate error occurred, this value is set to 1 and
further invocation of inflate/deflate will fail with further invocation of inflate/deflate will fail with
NGHTTP2_ERR_HEADER_COMP. */ NGHTTP2_ERR_HEADER_COMP. */
@ -132,17 +143,6 @@ typedef struct {
/* Set to this nonzero to clear reference set on each deflation each /* Set to this nonzero to clear reference set on each deflation each
time. */ time. */
uint8_t no_refset; uint8_t no_refset;
/* Role of this context; deflate or infalte */
nghttp2_hd_role role;
/* NGHTTP2_HD_SIDE_REQUEST for processing request, otherwise
response. */
nghttp2_hd_side side;
/* Keep track of allocated buffers in inflation */
uint8_t **buf_track;
/* The capacity of |buf_track| */
uint16_t buf_track_capacity;
/* The number of entry the |buf_track| contains. */
size_t buf_tracklen;
} nghttp2_hd_context; } nghttp2_hd_context;
/* /*

View File

@ -37,8 +37,8 @@
typedef uint32_t key_type; typedef uint32_t key_type;
typedef struct nghttp2_map_entry { typedef struct nghttp2_map_entry {
key_type key;
struct nghttp2_map_entry *next; struct nghttp2_map_entry *next;
key_type key;
} nghttp2_map_entry; } nghttp2_map_entry;
typedef struct { typedef struct {

View File

@ -43,18 +43,18 @@ typedef struct {
} nghttp2_headers_aux_data; } nghttp2_headers_aux_data;
typedef struct { typedef struct {
int64_t seq;
void *frame;
void *aux_data;
/* Type of |frame|. NGHTTP2_CTRL: nghttp2_frame*, NGHTTP2_DATA: /* Type of |frame|. NGHTTP2_CTRL: nghttp2_frame*, NGHTTP2_DATA:
nghttp2_data* */ nghttp2_data* */
nghttp2_frame_category frame_cat; nghttp2_frame_category frame_cat;
void *frame;
void *aux_data;
/* The priority used in priority comparion */ /* The priority used in priority comparion */
int32_t pri; int32_t pri;
/* The initial priority */ /* The initial priority */
int32_t inipri; int32_t inipri;
/* The amount of priority decrement in next time */ /* The amount of priority decrement in next time */
uint32_t pri_decay; uint32_t pri_decay;
int64_t seq;
} nghttp2_outbound_item; } nghttp2_outbound_item;
/* /*

View File

@ -81,12 +81,10 @@ typedef enum {
typedef struct { typedef struct {
nghttp2_frame frame; nghttp2_frame frame;
nghttp2_inbound_state state;
uint8_t headbuf[NGHTTP2_FRAME_HEAD_LENGTH];
/* How many bytes are filled in headbuf */
size_t headbufoff;
/* Payload for non-DATA frames. */ /* Payload for non-DATA frames. */
uint8_t *buf; uint8_t *buf;
/* How many bytes are filled in headbuf */
size_t headbufoff;
/* Capacity of buf */ /* Capacity of buf */
size_t bufmax; size_t bufmax;
/* For frames without name/value header block, this is how many /* For frames without name/value header block, this is how many
@ -100,8 +98,10 @@ typedef struct {
/* How many bytes are received for this frame. off <= payloadlen /* How many bytes are received for this frame. off <= payloadlen
must be fulfilled. */ must be fulfilled. */
size_t off; size_t off;
nghttp2_inbound_state state;
/* Error code */ /* Error code */
int error_code; int error_code;
uint8_t headbuf[NGHTTP2_FRAME_HEAD_LENGTH];
} nghttp2_inbound_frame; } nghttp2_inbound_frame;
typedef enum { typedef enum {
@ -115,7 +115,37 @@ typedef enum {
} nghttp2_goaway_flag; } nghttp2_goaway_flag;
struct nghttp2_session { struct nghttp2_session {
uint8_t server; nghttp2_map /* <nghttp2_stream*> */ streams;
/* Queue for outbound frames other than stream-creating HEADERS */
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_pq;
/* Queue for outbound stream-creating HEADERS frame */
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_ss_pq;
nghttp2_active_outbound_item aob;
nghttp2_inbound_frame iframe;
nghttp2_hd_context hd_deflater;
nghttp2_hd_context hd_inflater;
nghttp2_session_callbacks callbacks;
/* Sequence number of outbound frame to maintain the order of
enqueue if priority is equal. */
int64_t next_seq;
/* Buffer used to store inflated name/value pairs in wire format
temporarily on pack/unpack. */
uint8_t *nvbuf;
void *user_data;
/* In-flight SETTINGS values. NULL does not necessarily mean there
is no in-flight SETTINGS. */
nghttp2_settings_entry *inflight_iv;
/* The number of entries in |inflight_iv|. -1 if there is no
in-flight SETTINGS. */
ssize_t inflight_niv;
/* The number of outgoing streams. This will be capped by
remote_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
size_t num_outgoing_streams;
/* The number of incoming streams. This will be capped by
local_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
size_t num_incoming_streams;
/* The number of bytes allocated for nvbuf */
size_t nvbuflen;
/* Next Stream ID. Made unsigned int to detect >= (1 << 31). */ /* Next Stream ID. Made unsigned int to detect >= (1 << 31). */
uint32_t next_stream_id; uint32_t next_stream_id;
/* The largest stream ID received so far */ /* The largest stream ID received so far */
@ -127,51 +157,8 @@ struct nghttp2_session {
/* Counter of unique ID of PING. Wraps when it exceeds /* Counter of unique ID of PING. Wraps when it exceeds
NGHTTP2_MAX_UNIQUE_ID */ NGHTTP2_MAX_UNIQUE_ID */
uint32_t next_unique_id; uint32_t next_unique_id;
/* Sequence number of outbound frame to maintain the order of
enqueue if priority is equal. */
int64_t next_seq;
nghttp2_map /* <nghttp2_stream*> */ streams;
/* The number of outgoing streams. This will be capped by
remote_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
size_t num_outgoing_streams;
/* The number of incoming streams. This will be capped by
local_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]. */
size_t num_incoming_streams;
/* Queue for outbound frames other than stream-creating HEADERS */
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_pq;
/* Queue for outbound stream-creating HEADERS frame */
nghttp2_pq /* <nghttp2_outbound_item*> */ ob_ss_pq;
nghttp2_active_outbound_item aob;
nghttp2_inbound_frame iframe;
/* Buffer used to store inflated name/value pairs in wire format
temporarily on pack/unpack. */
uint8_t *nvbuf;
/* The number of bytes allocated for nvbuf */
size_t nvbuflen;
nghttp2_hd_context hd_deflater;
nghttp2_hd_context hd_inflater;
/* Flags indicating GOAWAY is sent and/or recieved. The flags are
composed by bitwise OR-ing nghttp2_goaway_flag. */
uint8_t goaway_flags;
/* This is the value in GOAWAY frame received from remote endpoint. */ /* This is the value in GOAWAY frame received from remote endpoint. */
int32_t last_stream_id; int32_t last_stream_id;
/* Non-zero indicates connection-level flow control on remote side
is in effect. This will be disabled when WINDOW_UPDATE with
END_FLOW_CONTROL bit set is received. */
uint8_t remote_flow_control;
/* Non-zero indicates connection-level flow control on local side is
in effect. This will be disabled when WINDOW_UPDATE with
END_FLOW_CONTROL bit set is sent. */
uint8_t local_flow_control;
/* Current sender window size. This value is computed against the /* Current sender window size. This value is computed against the
current initial window size of remote endpoint. */ current initial window size of remote endpoint. */
int32_t remote_window_size; int32_t remote_window_size;
@ -187,25 +174,26 @@ struct nghttp2_session {
increased/decreased by submitting WINDOW_UPDATE. See increased/decreased by submitting WINDOW_UPDATE. See
nghttp2_submit_window_update(). */ nghttp2_submit_window_update(). */
int32_t local_window_size; int32_t local_window_size;
/* Settings value received from the remote endpoint. We just use ID /* Settings value received from the remote endpoint. We just use ID
as index. The index = 0 is unused. */ as index. The index = 0 is unused. */
uint32_t remote_settings[NGHTTP2_SETTINGS_MAX+1]; uint32_t remote_settings[NGHTTP2_SETTINGS_MAX+1];
/* Settings value of the local endpoint. */ /* Settings value of the local endpoint. */
uint32_t local_settings[NGHTTP2_SETTINGS_MAX+1]; uint32_t local_settings[NGHTTP2_SETTINGS_MAX+1];
/* In-flight SETTINGS values. NULL does not necessarily mean there
is no in-flight SETTINGS. */
nghttp2_settings_entry *inflight_iv;
/* The number of entries in |inflight_iv|. -1 if there is no
in-flight SETTINGS. */
ssize_t inflight_niv;
/* Option flags. This is bitwise-OR of 0 or more of nghttp2_optmask. */ /* Option flags. This is bitwise-OR of 0 or more of nghttp2_optmask. */
uint32_t opt_flags; uint32_t opt_flags;
/* Nonzero if the session is server side. */
nghttp2_session_callbacks callbacks; uint8_t server;
void *user_data; /* Flags indicating GOAWAY is sent and/or recieved. The flags are
composed by bitwise OR-ing nghttp2_goaway_flag. */
uint8_t goaway_flags;
/* Non-zero indicates connection-level flow control on remote side
is in effect. This will be disabled when WINDOW_UPDATE with
END_FLOW_CONTROL bit set is received. */
uint8_t remote_flow_control;
/* Non-zero indicates connection-level flow control on local side is
in effect. This will be disabled when WINDOW_UPDATE with
END_FLOW_CONTROL bit set is sent. */
uint8_t local_flow_control;
}; };
/* Struct used when updating initial window size of each active /* Struct used when updating initial window size of each active

View File

@ -81,19 +81,33 @@ typedef enum {
typedef struct { typedef struct {
/* Intrusive Map */ /* Intrusive Map */
nghttp2_map_entry map_entry; nghttp2_map_entry map_entry;
/* stream ID */
int32_t stream_id;
nghttp2_stream_state state;
/* Use same value in SYN_STREAM frame */
uint8_t flags;
/* Use same value in SYN_STREAM frame */
int32_t pri;
/* Bitwise OR of zero or more nghttp2_shut_flag values */
uint8_t shut_flags;
/* The arbitrary data provided by user for this stream. */ /* The arbitrary data provided by user for this stream. */
void *stream_user_data; void *stream_user_data;
/* Deferred DATA frame */ /* Deferred DATA frame */
nghttp2_outbound_item *deferred_data; nghttp2_outbound_item *deferred_data;
/* stream ID */
int32_t stream_id;
/* Use same value in SYN_STREAM frame */
int32_t pri;
/* Current remote window size. This value is computed against the
current initial window size of remote endpoint. */
int32_t remote_window_size;
/* Keep track of the number of bytes received without
WINDOW_UPDATE. This could be negative after submitting negative
value to WINDOW_UPDATE */
int32_t recv_window_size;
/* The amount of recv_window_size cut using submitting negative
value to WINDOW_UPDATE */
int32_t recv_reduction;
/* window size for local flow control. It is initially set to
NGHTTP2_INITIAL_WINDOW_SIZE and could be increased/decreased by
submitting WINDOW_UPDATE. See nghttp2_submit_window_update(). */
int32_t local_window_size;
nghttp2_stream_state state;
/* Use same value in SYN_STREAM frame */
uint8_t flags;
/* Bitwise OR of zero or more nghttp2_shut_flag values */
uint8_t shut_flags;
/* The flags for defered DATA. Bitwise OR of zero or more /* The flags for defered DATA. Bitwise OR of zero or more
nghttp2_deferred_flag values */ nghttp2_deferred_flag values */
uint8_t deferred_flags; uint8_t deferred_flags;
@ -109,20 +123,6 @@ typedef struct {
flow control options off or sending WINDOW_UPDATE with flow control options off or sending WINDOW_UPDATE with
END_FLOW_CONTROL bit set. */ END_FLOW_CONTROL bit set. */
uint8_t local_flow_control; uint8_t local_flow_control;
/* Current remote window size. This value is computed against the
current initial window size of remote endpoint. */
int32_t remote_window_size;
/* Keep track of the number of bytes received without
WINDOW_UPDATE. This could be negative after submitting negative
value to WINDOW_UPDATE */
int32_t recv_window_size;
/* The amount of recv_window_size cut using submitting negative
value to WINDOW_UPDATE */
int32_t recv_reduction;
/* window size for local flow control. It is initially set to
NGHTTP2_INITIAL_WINDOW_SIZE and could be increased/decreased by
submitting WINDOW_UPDATE. See nghttp2_submit_window_update(). */
int32_t local_window_size;
} nghttp2_stream; } nghttp2_stream;
void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id, void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,

View File

@ -64,16 +64,16 @@ const std::string NGHTTPD_SERVER = "nghttpd nghttp2/" NGHTTP2_VERSION;
} // namespace } // namespace
Config::Config() Config::Config()
: verbose(false), : data_ptr(nullptr),
daemon(false),
port(0),
on_request_recv_callback(nullptr), on_request_recv_callback(nullptr),
data_ptr(nullptr), output_upper_thres(1024*1024),
header_table_size(-1),
port(0),
verbose(false),
daemon(false),
verify_client(false), verify_client(false),
no_tls(false), no_tls(false),
no_flow_control(false), no_flow_control(false)
output_upper_thres(1024*1024),
header_table_size(-1)
{} {}
Request::Request(int32_t stream_id) Request::Request(int32_t stream_id)
@ -175,10 +175,14 @@ void fill_callback(nghttp2_session_callbacks& callbacks, const Config *config);
Http2Handler::Http2Handler(Sessions *sessions, Http2Handler::Http2Handler(Sessions *sessions,
int fd, SSL *ssl, int64_t session_id) int fd, SSL *ssl, int64_t session_id)
: session_(nullptr), sessions_(sessions), bev_(nullptr), fd_(fd), ssl_(ssl), : session_id_(session_id),
session_id_(session_id), session_(nullptr),
sessions_(sessions),
bev_(nullptr),
ssl_(ssl),
settings_timerev_(nullptr),
left_connhd_len_(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN), left_connhd_len_(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN),
settings_timerev_(nullptr) fd_(fd)
{} {}
Http2Handler::~Http2Handler() Http2Handler::~Http2Handler()

View File

@ -48,29 +48,29 @@ namespace nghttp2 {
struct Config { struct Config {
std::string htdocs; std::string htdocs;
bool verbose;
bool daemon;
std::string host; std::string host;
uint16_t port;
std::string private_key_file; std::string private_key_file;
std::string cert_file; std::string cert_file;
nghttp2_on_request_recv_callback on_request_recv_callback;
void *data_ptr; void *data_ptr;
nghttp2_on_request_recv_callback on_request_recv_callback;
size_t output_upper_thres;
ssize_t header_table_size;
uint16_t port;
bool verbose;
bool daemon;
bool verify_client; bool verify_client;
bool no_tls; bool no_tls;
bool no_flow_control; bool no_flow_control;
size_t output_upper_thres;
ssize_t header_table_size;
Config(); Config();
}; };
class Sessions; class Sessions;
struct Request { struct Request {
int32_t stream_id;
std::vector<std::pair<std::string, std::string>> headers; std::vector<std::pair<std::string, std::string>> headers;
int file;
std::pair<std::string, size_t> response_body; std::pair<std::string, size_t> response_body;
int32_t stream_id;
int file;
Request(int32_t stream_id); Request(int32_t stream_id);
~Request(); ~Request();
}; };
@ -118,15 +118,15 @@ public:
void remove_settings_timer(); void remove_settings_timer();
void submit_goaway(nghttp2_error_code error_code); void submit_goaway(nghttp2_error_code error_code);
private: private:
std::map<int32_t, std::unique_ptr<Request>> id2req_;
int64_t session_id_;
nghttp2_session *session_; nghttp2_session *session_;
Sessions *sessions_; Sessions *sessions_;
bufferevent *bev_; bufferevent *bev_;
int fd_;
SSL* ssl_; SSL* ssl_;
int64_t session_id_;
std::map<int32_t, std::unique_ptr<Request>> id2req_;
size_t left_connhd_len_;
event *settings_timerev_; event *settings_timerev_;
size_t left_connhd_len_;
int fd_;
}; };
class HttpServer { class HttpServer {

View File

@ -78,6 +78,19 @@ namespace nghttp2 {
namespace { namespace {
struct Config { struct Config {
std::vector<std::pair<std::string, std::string>> headers;
std::string certfile;
std::string keyfile;
std::string datafile;
size_t output_upper_thres;
ssize_t peer_max_concurrent_streams;
ssize_t header_table_size;
int32_t pri;
int multiply;
// milliseconds
int timeout;
int window_bits;
int connection_window_bits;
bool null_out; bool null_out;
bool remote_name; bool remote_name;
bool verbose; bool verbose;
@ -85,35 +98,22 @@ struct Config {
bool stat; bool stat;
bool no_flow_control; bool no_flow_control;
bool upgrade; bool upgrade;
int32_t pri;
int multiply;
// milliseconds
int timeout;
std::string certfile;
std::string keyfile;
int window_bits;
int connection_window_bits;
std::vector<std::pair<std::string, std::string>> headers;
std::string datafile;
size_t output_upper_thres;
ssize_t peer_max_concurrent_streams;
ssize_t header_table_size;
Config() Config()
: null_out(false), : output_upper_thres(1024*1024),
remote_name(false), peer_max_concurrent_streams(NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS),
verbose(false), header_table_size(-1),
get_assets(false),
stat(false),
no_flow_control(false),
upgrade(false),
pri(NGHTTP2_PRI_DEFAULT), pri(NGHTTP2_PRI_DEFAULT),
multiply(1), multiply(1),
timeout(-1), timeout(-1),
window_bits(-1), window_bits(-1),
connection_window_bits(-1), connection_window_bits(-1),
output_upper_thres(1024*1024), null_out(false),
peer_max_concurrent_streams(NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS), remote_name(false),
header_table_size(-1) verbose(false),
get_assets(false),
stat(false),
no_flow_control(false),
upgrade(false)
{} {}
}; };
} // namespace } // namespace
@ -248,23 +248,28 @@ namespace {
struct Request { struct Request {
// URI without fragment // URI without fragment
std::string uri; std::string uri;
std::string status;
http_parser_url u; http_parser_url u;
RequestStat stat;
int64_t data_length;
int64_t data_offset;
nghttp2_gzip *inflater; nghttp2_gzip *inflater;
HtmlParser *html_parser; HtmlParser *html_parser;
const nghttp2_data_provider *data_prd; const nghttp2_data_provider *data_prd;
int64_t data_length;
int64_t data_offset;
int32_t pri; int32_t pri;
// Recursion level: 0: first entity, 1: entity linked from first entity // Recursion level: 0: first entity, 1: entity linked from first entity
int level; int level;
RequestStat stat;
std::string status;
Request(const std::string& uri, const http_parser_url &u, Request(const std::string& uri, const http_parser_url &u,
const nghttp2_data_provider *data_prd, int64_t data_length, const nghttp2_data_provider *data_prd, int64_t data_length,
int32_t pri, int level = 0) int32_t pri, int level = 0)
: uri(uri), u(u), : uri(uri),
inflater(nullptr), html_parser(nullptr), data_prd(data_prd), u(u),
data_length(data_length), data_offset(0), pri(pri), data_length(data_length),
data_offset(0),
inflater(nullptr),
html_parser(nullptr),
data_prd(data_prd),
pri(pri),
level(level) level(level)
{} {}
@ -422,6 +427,17 @@ enum client_state {
namespace { namespace {
struct HttpClient { struct HttpClient {
std::vector<std::unique_ptr<Request>> reqvec;
// Map from stream ID to Request object.
std::map<int32_t, Request*> streams;
// Insert path already added in reqvec to prevent multiple request
// for 1 resource.
std::set<std::string> path_cache;
std::string scheme;
std::string hostport;
// Used for parse the HTTP upgrade response from server
std::unique_ptr<http_parser> htp;
SessionStat stat;
nghttp2_session *session; nghttp2_session *session;
const nghttp2_session_callbacks *callbacks; const nghttp2_session_callbacks *callbacks;
event_base *evbase; event_base *evbase;
@ -430,29 +446,18 @@ struct HttpClient {
SSL *ssl; SSL *ssl;
bufferevent *bev; bufferevent *bev;
event *settings_timerev; event *settings_timerev;
client_state state;
std::vector<std::unique_ptr<Request>> reqvec;
// Map from stream ID to Request object.
std::map<int32_t, Request*> streams;
// Insert path already added in reqvec to prevent multiple request
// for 1 resource.
std::set<std::string> path_cache;
// The number of completed requests, including failed ones. // The number of completed requests, including failed ones.
size_t complete; size_t complete;
std::string scheme; // The length of settings_payload
std::string hostport; size_t settings_payloadlen;
SessionStat stat; client_state state;
// Used for parse the HTTP upgrade response from server // The HTTP status code of the response message of HTTP Upgrade.
std::unique_ptr<http_parser> htp; unsigned int upgrade_response_status_code;
// true if the response message of HTTP Upgrade request is fully // true if the response message of HTTP Upgrade request is fully
// received. It is not relevant the upgrade succeeds, or not. // received. It is not relevant the upgrade succeeds, or not.
bool upgrade_response_complete; bool upgrade_response_complete;
// The HTTP status code of the response message of HTTP Upgrade.
unsigned int upgrade_response_status_code;
// SETTINGS payload sent as token68 in HTTP Upgrade // SETTINGS payload sent as token68 in HTTP Upgrade
uint8_t settings_payload[16]; uint8_t settings_payload[16];
// The length of settings_payload
size_t settings_payloadlen;
HttpClient(const nghttp2_session_callbacks* callbacks, HttpClient(const nghttp2_session_callbacks* callbacks,
event_base *evbase, SSL_CTX *ssl_ctx) event_base *evbase, SSL_CTX *ssl_ctx)
@ -464,11 +469,11 @@ struct HttpClient {
ssl(nullptr), ssl(nullptr),
bev(nullptr), bev(nullptr),
settings_timerev(nullptr), settings_timerev(nullptr),
state(STATE_IDLE),
complete(0), complete(0),
upgrade_response_complete(false), settings_payloadlen(0),
state(STATE_IDLE),
upgrade_response_status_code(0), upgrade_response_status_code(0),
settings_payloadlen(0) upgrade_response_complete(false)
{} {}
~HttpClient() ~HttpClient()

View File

@ -213,13 +213,13 @@ void upstream_http1_connhd_readcb(bufferevent *bev, void *arg)
ClientHandler::ClientHandler(bufferevent *bev, int fd, SSL *ssl, ClientHandler::ClientHandler(bufferevent *bev, int fd, SSL *ssl,
const char *ipaddr) const char *ipaddr)
: bev_(bev), : ipaddr_(ipaddr),
fd_(fd), bev_(bev),
ssl_(ssl),
ipaddr_(ipaddr),
should_close_after_write_(false),
http2session_(nullptr), http2session_(nullptr),
left_connhd_len_(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN) ssl_(ssl),
left_connhd_len_(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN),
fd_(fd),
should_close_after_write_(false)
{ {
bufferevent_set_rate_limit(bev_, get_config()->rate_limit_cfg); bufferevent_set_rate_limit(bev_, get_config()->rate_limit_cfg);
bufferevent_enable(bev_, EV_READ | EV_WRITE); bufferevent_enable(bev_, EV_READ | EV_WRITE);

View File

@ -76,18 +76,18 @@ public:
int perform_http2_upgrade(HttpsUpstream *http); int perform_http2_upgrade(HttpsUpstream *http);
bool get_http2_upgrade_allowed() const; bool get_http2_upgrade_allowed() const;
private: private:
bufferevent *bev_; std::set<DownstreamConnection*> dconn_pool_;
int fd_;
SSL *ssl_;
std::unique_ptr<Upstream> upstream_; std::unique_ptr<Upstream> upstream_;
std::string ipaddr_; std::string ipaddr_;
bool should_close_after_write_; bufferevent *bev_;
std::set<DownstreamConnection*> dconn_pool_;
// Shared HTTP2 session for each thread. NULL if backend is not // Shared HTTP2 session for each thread. NULL if backend is not
// HTTP2. Not deleted by this object. // HTTP2. Not deleted by this object.
Http2Session *http2session_; Http2Session *http2session_;
SSL *ssl_;
// The number of bytes of HTTP/2.0 client connection header to read // The number of bytes of HTTP/2.0 client connection header to read
size_t left_connhd_len_; size_t left_connhd_len_;
int fd_;
bool should_close_after_write_;
}; };
} // namespace shrpx } // namespace shrpx

View File

@ -115,89 +115,41 @@ enum shrpx_proto {
}; };
struct Config { struct Config {
bool verbose; // The list of (private key file, certificate file) pair
bool daemon; std::vector<std::pair<std::string, std::string>> subcerts;
char *host;
uint16_t port;
char *private_key_file;
char *private_key_passwd;
char *cert_file;
char *dh_param_file;
SSL_CTX *default_ssl_ctx;
ssl::CertLookupTree *cert_tree;
bool verify_client;
const char *server_name;
char *downstream_host;
uint16_t downstream_port;
char *downstream_hostport;
sockaddr_union downstream_addr; sockaddr_union downstream_addr;
size_t downstream_addrlen; // binary form of http proxy host and port
sockaddr_union downstream_http_proxy_addr;
timeval http2_upstream_read_timeout; timeval http2_upstream_read_timeout;
timeval upstream_read_timeout; timeval upstream_read_timeout;
timeval upstream_write_timeout; timeval upstream_write_timeout;
timeval downstream_read_timeout; timeval downstream_read_timeout;
timeval downstream_write_timeout; timeval downstream_write_timeout;
timeval downstream_idle_read_timeout; timeval downstream_idle_read_timeout;
size_t num_worker; char *host;
size_t http2_max_concurrent_streams; char *private_key_file;
bool http2_proxy; char *private_key_passwd;
bool http2_bridge; char *cert_file;
bool client_proxy; char *dh_param_file;
bool add_x_forwarded_for; SSL_CTX *default_ssl_ctx;
bool no_via; ssl::CertLookupTree *cert_tree;
bool accesslog; const char *server_name;
size_t http2_upstream_window_bits; char *downstream_host;
size_t http2_downstream_window_bits; char *downstream_hostport;
size_t http2_upstream_connection_window_bits;
size_t http2_downstream_connection_window_bits;
bool upstream_no_tls;
bool downstream_no_tls;
char *backend_tls_sni_name; char *backend_tls_sni_name;
char *pid_file; char *pid_file;
uid_t uid;
gid_t gid;
char *conf_path; char *conf_path;
bool syslog;
int syslog_facility;
// This member finally decides syslog is used or not
bool use_syslog;
int backlog;
char *ciphers; char *ciphers;
bool honor_cipher_order;
bool client;
// true if --client or --client-proxy are enabled.
bool client_mode;
// downstream protocol; this will be determined by given options.
shrpx_proto downstream_proto;
bool insecure;
char *cacert; char *cacert;
bool backend_ipv4;
bool backend_ipv6;
// true if stderr refers to a terminal.
bool tty;
// userinfo in http proxy URI, not percent-encoded form // userinfo in http proxy URI, not percent-encoded form
char *downstream_http_proxy_userinfo; char *downstream_http_proxy_userinfo;
// host in http proxy URI // host in http proxy URI
char *downstream_http_proxy_host; char *downstream_http_proxy_host;
// port in http proxy URI
uint16_t downstream_http_proxy_port;
// binary form of http proxy host and port
sockaddr_union downstream_http_proxy_addr;
// actual size of downstream_http_proxy_addr
size_t downstream_http_proxy_addrlen;
// Rate limit configuration // Rate limit configuration
ev_token_bucket_cfg *rate_limit_cfg; ev_token_bucket_cfg *rate_limit_cfg;
size_t read_rate;
size_t read_burst;
size_t write_rate;
size_t write_burst;
// Comma delimited list of NPN protocol strings in the order of // Comma delimited list of NPN protocol strings in the order of
// preference. // preference.
char **npn_list; char **npn_list;
// The number of elements in npn_list
size_t npn_list_len;
// The list of (private key file, certificate file) pair
std::vector<std::pair<std::string, std::string>> subcerts;
// Path to file containing CA certificate solely used for client // Path to file containing CA certificate solely used for client
// certificate validation // certificate validation
char *verify_client_cacert; char *verify_client_cacert;
@ -205,6 +157,54 @@ struct Config {
char *client_cert_file; char *client_cert_file;
FILE *http2_upstream_dump_request_header; FILE *http2_upstream_dump_request_header;
FILE *http2_upstream_dump_response_header; FILE *http2_upstream_dump_response_header;
size_t downstream_addrlen;
size_t num_worker;
size_t http2_max_concurrent_streams;
size_t http2_upstream_window_bits;
size_t http2_downstream_window_bits;
size_t http2_upstream_connection_window_bits;
size_t http2_downstream_connection_window_bits;
// actual size of downstream_http_proxy_addr
size_t downstream_http_proxy_addrlen;
size_t read_rate;
size_t read_burst;
size_t write_rate;
size_t write_burst;
// The number of elements in npn_list
size_t npn_list_len;
// downstream protocol; this will be determined by given options.
shrpx_proto downstream_proto;
int syslog_facility;
int backlog;
uid_t uid;
gid_t gid;
uint16_t port;
uint16_t downstream_port;
// port in http proxy URI
uint16_t downstream_http_proxy_port;
bool verbose;
bool daemon;
bool verify_client;
bool http2_proxy;
bool http2_bridge;
bool client_proxy;
bool add_x_forwarded_for;
bool no_via;
bool accesslog;
bool upstream_no_tls;
bool downstream_no_tls;
bool syslog;
// This member finally decides syslog is used or not
bool use_syslog;
bool honor_cipher_order;
bool client;
// true if --client or --client-proxy are enabled.
bool client_mode;
bool insecure;
bool backend_ipv4;
bool backend_ipv6;
// true if stderr refers to a terminal.
bool tty;
bool http2_no_cookie_crumbling; bool http2_no_cookie_crumbling;
}; };

View File

@ -38,30 +38,30 @@ using namespace nghttp2;
namespace shrpx { namespace shrpx {
Downstream::Downstream(Upstream *upstream, int stream_id, int priority) Downstream::Downstream(Upstream *upstream, int stream_id, int priority)
: upstream_(upstream), : request_bodylen_(0),
upstream_(upstream),
dconn_(nullptr), dconn_(nullptr),
response_body_buf_(nullptr),
stream_id_(stream_id), stream_id_(stream_id),
priority_(priority), priority_(priority),
downstream_stream_id_(-1), downstream_stream_id_(-1),
upgrade_request_(false), response_rst_stream_error_code_(NGHTTP2_NO_ERROR),
upgraded_(false),
request_state_(INITIAL), request_state_(INITIAL),
request_major_(1), request_major_(1),
request_minor_(1), request_minor_(1),
chunked_request_(false),
request_connection_close_(false),
request_expect_100_continue_(false),
request_header_key_prev_(false),
request_bodylen_(0),
response_state_(INITIAL), response_state_(INITIAL),
response_http_status_(0), response_http_status_(0),
response_major_(1), response_major_(1),
response_minor_(1), response_minor_(1),
upgrade_request_(false),
upgraded_(false),
chunked_request_(false),
request_connection_close_(false),
request_expect_100_continue_(false),
request_header_key_prev_(false),
chunked_response_(false), chunked_response_(false),
response_connection_close_(false), response_connection_close_(false),
response_header_key_prev_(false), response_header_key_prev_(false)
response_body_buf_(nullptr),
response_rst_stream_error_code_(NGHTTP2_NO_ERROR)
{} {}
Downstream::~Downstream() Downstream::~Downstream()

View File

@ -178,47 +178,54 @@ public:
static const size_t OUTPUT_UPPER_THRES = 64*1024; static const size_t OUTPUT_UPPER_THRES = 64*1024;
private: private:
Headers request_headers_;
Headers response_headers_;
std::string request_method_;
std::string request_path_;
std::string request_http2_scheme_;
std::string request_http2_authority_;
std::string assembled_request_cookie_;
// the length of request body
int64_t request_bodylen_;
Upstream *upstream_; Upstream *upstream_;
DownstreamConnection *dconn_; DownstreamConnection *dconn_;
// This buffer is used to temporarily store downstream response
// body. nghttp2 library reads data from this in the callback.
evbuffer *response_body_buf_;
int32_t stream_id_; int32_t stream_id_;
int32_t priority_; int32_t priority_;
// stream ID in backend connection // stream ID in backend connection
int32_t downstream_stream_id_; int32_t downstream_stream_id_;
// RST_STREAM error_code from downstream HTTP2 connection
nghttp2_error_code response_rst_stream_error_code_;
int request_state_;
int request_major_;
int request_minor_;
int response_state_;
unsigned int response_http_status_;
int response_major_;
int response_minor_;
// true if the request contains upgrade token (HTTP Upgrade or // true if the request contains upgrade token (HTTP Upgrade or
// CONNECT) // CONNECT)
bool upgrade_request_; bool upgrade_request_;
// true if the connection is upgraded (HTTP Upgrade or CONNECT) // true if the connection is upgraded (HTTP Upgrade or CONNECT)
bool upgraded_; bool upgraded_;
int request_state_;
std::string request_method_;
std::string request_path_;
std::string request_http2_scheme_;
std::string request_http2_authority_;
int request_major_;
int request_minor_;
bool chunked_request_; bool chunked_request_;
bool request_connection_close_; bool request_connection_close_;
bool request_expect_100_continue_; bool request_expect_100_continue_;
std::string assembled_request_cookie_;
Headers request_headers_;
bool request_header_key_prev_; bool request_header_key_prev_;
// the length of request body
int64_t request_bodylen_;
int response_state_;
unsigned int response_http_status_;
int response_major_;
int response_minor_;
bool chunked_response_; bool chunked_response_;
bool response_connection_close_; bool response_connection_close_;
Headers response_headers_;
bool response_header_key_prev_; bool response_header_key_prev_;
// This buffer is used to temporarily store downstream response
// body. nghttp2 library reads data from this in the callback.
evbuffer *response_body_buf_;
// RST_STREAM error_code from downstream HTTP2 connection
nghttp2_error_code response_rst_stream_error_code_;
}; };
} // namespace shrpx } // namespace shrpx

View File

@ -52,15 +52,15 @@ Http2Session::Http2Session(event_base *evbase, SSL_CTX *ssl_ctx)
: evbase_(evbase), : evbase_(evbase),
ssl_ctx_(ssl_ctx), ssl_ctx_(ssl_ctx),
ssl_(nullptr), ssl_(nullptr),
fd_(-1),
session_(nullptr), session_(nullptr),
bev_(nullptr), bev_(nullptr),
state_(DISCONNECTED),
notified_(false),
wrbev_(nullptr), wrbev_(nullptr),
rdbev_(nullptr), rdbev_(nullptr),
flow_control_(false), settings_timerev_(nullptr),
settings_timerev_(nullptr) fd_(-1),
state_(DISCONNECTED),
notified_(false),
flow_control_(false)
{} {}
Http2Session::~Http2Session() Http2Session::~Http2Session()

View File

@ -117,27 +117,27 @@ public:
CONNECTED CONNECTED
}; };
private: private:
std::set<Http2DownstreamConnection*> dconns_;
std::set<StreamData*> streams_;
// Used to parse the response from HTTP proxy
std::unique_ptr<http_parser> proxy_htp_;
event_base *evbase_; event_base *evbase_;
// NULL if no TLS is configured // NULL if no TLS is configured
SSL_CTX *ssl_ctx_; SSL_CTX *ssl_ctx_;
SSL *ssl_; SSL *ssl_;
nghttp2_session *session_;
bufferevent *bev_;
bufferevent *wrbev_;
bufferevent *rdbev_;
event *settings_timerev_;
// fd_ is used for proxy connection and no TLS connection. For // fd_ is used for proxy connection and no TLS connection. For
// direct or TLS connection, it may be -1 even after connection is // direct or TLS connection, it may be -1 even after connection is
// established. Use bufferevent_getfd(bev_) to get file descriptor // established. Use bufferevent_getfd(bev_) to get file descriptor
// in these cases. // in these cases.
int fd_; int fd_;
nghttp2_session *session_;
bufferevent *bev_;
std::set<Http2DownstreamConnection*> dconns_;
std::set<StreamData*> streams_;
int state_; int state_;
bool notified_; bool notified_;
bufferevent *wrbev_;
bufferevent *rdbev_;
bool flow_control_; bool flow_control_;
// Used to parse the response from HTTP proxy
std::unique_ptr<http_parser> proxy_htp_;
event *settings_timerev_;
}; };
} // namespace shrpx } // namespace shrpx

View File

@ -80,12 +80,12 @@ public:
int start_settings_timer(); int start_settings_timer();
void stop_settings_timer(); void stop_settings_timer();
private: private:
ClientHandler *handler_;
nghttp2_session *session_;
bool flow_control_;
DownstreamQueue downstream_queue_; DownstreamQueue downstream_queue_;
std::unique_ptr<HttpsUpstream> pre_upstream_; std::unique_ptr<HttpsUpstream> pre_upstream_;
ClientHandler *handler_;
nghttp2_session *session_;
event *settings_timerev_; event *settings_timerev_;
bool flow_control_;
}; };
} // namespace shrpx } // namespace shrpx

View File

@ -46,10 +46,10 @@ ListenHandler::ListenHandler(event_base *evbase, SSL_CTX *sv_ssl_ctx,
: evbase_(evbase), : evbase_(evbase),
sv_ssl_ctx_(sv_ssl_ctx), sv_ssl_ctx_(sv_ssl_ctx),
cl_ssl_ctx_(cl_ssl_ctx), cl_ssl_ctx_(cl_ssl_ctx),
worker_round_robin_cnt_(0),
workers_(nullptr), workers_(nullptr),
http2session_(nullptr),
num_worker_(0), num_worker_(0),
http2session_(nullptr) worker_round_robin_cnt_(0)
{} {}
ListenHandler::~ListenHandler() ListenHandler::~ListenHandler()

View File

@ -37,10 +37,10 @@
namespace shrpx { namespace shrpx {
struct WorkerInfo { struct WorkerInfo {
int sv[2];
SSL_CTX *sv_ssl_ctx; SSL_CTX *sv_ssl_ctx;
SSL_CTX *cl_ssl_ctx; SSL_CTX *cl_ssl_ctx;
bufferevent *bev; bufferevent *bev;
int sv[2];
}; };
class Http2Session; class Http2Session;
@ -59,12 +59,12 @@ private:
SSL_CTX *sv_ssl_ctx_; SSL_CTX *sv_ssl_ctx_;
// The backend server SSL_CTX // The backend server SSL_CTX
SSL_CTX *cl_ssl_ctx_; SSL_CTX *cl_ssl_ctx_;
unsigned int worker_round_robin_cnt_;
WorkerInfo *workers_; WorkerInfo *workers_;
size_t num_worker_;
// Shared backend HTTP2 session. NULL if multi-threaded. In // Shared backend HTTP2 session. NULL if multi-threaded. In
// multi-threaded case, see shrpx_worker.cc. // multi-threaded case, see shrpx_worker.cc.
Http2Session *http2session_; Http2Session *http2session_;
size_t num_worker_;
unsigned int worker_round_robin_cnt_;
}; };
} // namespace shrpx } // namespace shrpx

View File

@ -83,8 +83,8 @@ int severity_to_syslog_level(int severity)
} }
Log::Log(int severity, const char *filename, int linenum) Log::Log(int severity, const char *filename, int linenum)
: severity_(severity), : filename_(filename),
filename_(filename), severity_(severity),
linenum_(linenum) linenum_(linenum)
{} {}

View File

@ -88,10 +88,10 @@ public:
return severity >= severity_thres_; return severity >= severity_thres_;
} }
private: private:
int severity_;
const char *filename_;
int linenum_;
std::stringstream stream_; std::stringstream stream_;
const char *filename_;
int severity_;
int linenum_;
static int severity_thres_; static int severity_thres_;
}; };

View File

@ -372,7 +372,7 @@ uint32_t infer_upstream_rst_stream_status_code
SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler) SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
: handler_(handler), : handler_(handler),
session_(0) session_(nullptr)
{ {
//handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb); //handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb);
handler->set_upstream_timeouts(&get_config()->http2_upstream_read_timeout, handler->set_upstream_timeouts(&get_config()->http2_upstream_read_timeout,

View File

@ -68,11 +68,11 @@ public:
bool get_flow_control() const; bool get_flow_control() const;
private: private:
DownstreamQueue downstream_queue_;
ClientHandler *handler_; ClientHandler *handler_;
spdylay_session *session_; spdylay_session *session_;
bool flow_control_;
int32_t initial_window_size_; int32_t initial_window_size_;
DownstreamQueue downstream_queue_; bool flow_control_;
}; };
} // namespace shrpx } // namespace shrpx

View File

@ -38,9 +38,9 @@ namespace shrpx {
class Http2Session; class Http2Session;
struct WorkerEvent { struct WorkerEvent {
evutil_socket_t client_fd;
sockaddr_union client_addr; sockaddr_union client_addr;
size_t client_addrlen; size_t client_addrlen;
evutil_socket_t client_fd;
}; };
class ThreadEventReceiver { class ThreadEventReceiver {

View File

@ -43,9 +43,9 @@ using namespace nghttp2;
namespace shrpx { namespace shrpx {
Worker::Worker(WorkerInfo *info) Worker::Worker(WorkerInfo *info)
: fd_(info->sv[1]), : sv_ssl_ctx_(info->sv_ssl_ctx),
sv_ssl_ctx_(info->sv_ssl_ctx), cl_ssl_ctx_(info->cl_ssl_ctx),
cl_ssl_ctx_(info->cl_ssl_ctx) fd_(info->sv[1])
{} {}
Worker::~Worker() Worker::~Worker()

View File

@ -40,10 +40,10 @@ public:
~Worker(); ~Worker();
void run(); void run();
private: private:
// Channel to the main thread
int fd_;
SSL_CTX *sv_ssl_ctx_; SSL_CTX *sv_ssl_ctx_;
SSL_CTX *cl_ssl_ctx_; SSL_CTX *cl_ssl_ctx_;
// Channel to the main thread
int fd_;
}; };
void start_threaded_worker(WorkerInfo *info); void start_threaded_worker(WorkerInfo *info);