up session cache校验ssl version,增加ssl状态读写的接口。
This commit is contained in:
@@ -341,6 +341,10 @@ int tfe_stream_action_set_opt(const struct tfe_stream * stream, enum tfe_stream_
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tfe_stream_set_integer_opt(struct tfe_stream * stream, enum tfe_stream_opt_level level, int type, int val)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
/* ====================================================================================================================
|
||||
* CONNECTION STRUCTURE AND OPERATION FUCTIONS
|
||||
* ===================================================================================================================*/
|
||||
@@ -795,7 +799,15 @@ static tfe_conn_private * __conn_private_create_by_bev(struct tfe_stream_private
|
||||
__conn_private->bev = bev;
|
||||
__conn_private->fd = bufferevent_getfd(bev);
|
||||
|
||||
bufferevent_setcb(__conn_private->bev, __stream_bev_readcb, __stream_bev_writecb, __stream_bev_eventcb, stream);
|
||||
if(stream->tcp_passthough)
|
||||
{
|
||||
bufferevent_setcb(__conn_private->bev, __stream_bev_passthrough_readcb,
|
||||
__stream_bev_passthrough_writecb, __stream_bev_passthrough_eventcb, stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufferevent_setcb(__conn_private->bev, __stream_bev_readcb, __stream_bev_writecb, __stream_bev_eventcb, stream);
|
||||
}
|
||||
bufferevent_disable(__conn_private->bev, EV_READ | EV_WRITE);
|
||||
|
||||
struct tfe_proxy * proxy_ref = stream->proxy_ref;
|
||||
@@ -825,7 +837,7 @@ static tfe_conn_private * __conn_private_create_by_fd(struct tfe_stream_private
|
||||
goto __errout;
|
||||
}
|
||||
|
||||
if (stream->passthough)
|
||||
if (stream->tcp_passthough)
|
||||
{
|
||||
bufferevent_setcb(__conn_private->bev, __stream_bev_passthrough_readcb,
|
||||
__stream_bev_passthrough_writecb, __stream_bev_passthrough_eventcb, stream);
|
||||
@@ -896,28 +908,43 @@ void ssl_downstream_create_on_fail(enum e_future_error err, const char * what, v
|
||||
void ssl_upstream_create_on_success(future_result_t * result, void * user)
|
||||
{
|
||||
struct tfe_stream_private * _stream = (struct tfe_stream_private *) user;
|
||||
evutil_socket_t fd=-1;
|
||||
enum ssl_stream_action ssl_action=ssl_upstream_create_result_release_action(result);
|
||||
if(SSL_ACTION_PASSTHROUGH==ssl_action)
|
||||
{
|
||||
_stream->tcp_passthough=1;
|
||||
fd=ssl_upstream_create_result_release_fd(result);
|
||||
_stream->conn_upstream=__conn_private_create_by_fd(_stream, fd);
|
||||
_stream->conn_downstream=__conn_private_create_by_fd(_stream, _stream->defer_fd_downstream);
|
||||
}
|
||||
else if(SSL_ACTION_SHUTDOWN==ssl_action)
|
||||
{
|
||||
tfe_stream_destory(_stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct ssl_stream * upstream = ssl_upstream_create_result_release_stream(result);
|
||||
struct bufferevent * bev = ssl_upstream_create_result_release_bev(result);
|
||||
assert(upstream != NULL && bev != NULL);
|
||||
|
||||
struct ssl_stream * upstream = ssl_upstream_create_result_release_stream(result);
|
||||
struct bufferevent * bev = ssl_upstream_create_result_release_bev(result);
|
||||
assert(upstream != NULL && bev != NULL);
|
||||
/* Create connection ctx by bev */
|
||||
_stream->conn_upstream = __conn_private_create_by_bev(_stream, bev);
|
||||
_stream->ssl_upstream = upstream;
|
||||
|
||||
/* Create connection ctx by bev */
|
||||
_stream->conn_upstream = __conn_private_create_by_bev(_stream, bev);
|
||||
_stream->ssl_upstream = upstream;
|
||||
assert(_stream->conn_upstream != NULL);
|
||||
assert(_stream->ssl_upstream != NULL);
|
||||
|
||||
assert(_stream->conn_upstream != NULL);
|
||||
assert(_stream->ssl_upstream != NULL);
|
||||
future_destroy(_stream->future_upstream_create);
|
||||
_stream->future_upstream_create = NULL;
|
||||
_stream->defer_fd_upstream = 0;
|
||||
|
||||
future_destroy(_stream->future_upstream_create);
|
||||
_stream->future_upstream_create = NULL;
|
||||
_stream->defer_fd_upstream = 0;
|
||||
/* Next, create downstream */
|
||||
_stream->future_downstream_create = future_create("ssl_down", ssl_downstream_create_on_success,
|
||||
ssl_downstream_create_on_fail, _stream);
|
||||
|
||||
/* Next, create downstream */
|
||||
_stream->future_downstream_create = future_create("ssl_down", ssl_downstream_create_on_success,
|
||||
ssl_downstream_create_on_fail, _stream);
|
||||
|
||||
ssl_async_downstream_create(_stream->future_downstream_create, _stream->ssl_mgr,
|
||||
_stream->ssl_upstream, _stream->defer_fd_downstream, _stream->keyring_id, _stream->thread_ref->thread_id);
|
||||
ssl_async_downstream_create(_stream->future_downstream_create, _stream->ssl_mgr,
|
||||
_stream->ssl_upstream, _stream->defer_fd_downstream, _stream->keyring_id, _stream->thread_ref->thread_id);
|
||||
}
|
||||
}
|
||||
|
||||
void ssl_upstream_create_on_fail(enum e_future_error err, const char * what, void * user)
|
||||
@@ -948,7 +975,7 @@ struct tfe_stream * tfe_stream_create(struct tfe_proxy * pxy, struct tfe_thread_
|
||||
|
||||
void __stream_access_log_write(struct tfe_stream_private * stream)
|
||||
{
|
||||
const char * str_passthrough = stream->passthough ? "PASSTHROUGH" : "-";
|
||||
const char * str_passthrough = stream->tcp_passthough ? "PASSTHROUGH" : "-";
|
||||
const char * str_kill = stream->need_to_be_kill ? "KILL" : "-";
|
||||
|
||||
char str_log_event[TFE_STRING_MAX] = "";
|
||||
@@ -1259,7 +1286,7 @@ int tfe_stream_option_set(struct tfe_stream * stream, enum tfe_stream_option opt
|
||||
else if (opt == TFE_STREAM_OPT_PASSTHROUGH)
|
||||
{
|
||||
assert(sz_arg == sizeof(bool));
|
||||
_stream->passthough = *(bool *) arg;
|
||||
_stream->tcp_passthough = *(bool *) arg;
|
||||
}
|
||||
else if (opt == TFE_STREAM_OPT_KEYRING_ID)
|
||||
{
|
||||
@@ -1300,4 +1327,4 @@ void tfe_stream_kill(const struct tfe_stream * stream)
|
||||
{
|
||||
struct tfe_stream_private * _stream = to_stream_private(stream);
|
||||
_stream->need_to_be_kill = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user