定义future_result_t,整理ssl_stream.h

This commit is contained in:
zhengchao
2018-08-21 19:32:37 +08:00
parent 2cc0d49d29
commit be813f99a4
5 changed files with 26 additions and 16 deletions

View File

@@ -31,7 +31,6 @@ struct peek_client_hello_ctx
{
unsigned char sni_peek_retries; /* max 64 SNI parse retries */
struct event* ev;
struct event_base* evbase;
@@ -46,7 +45,7 @@ void peek_client_hello_ctx_free(void* ctx)
free(_ctx);
return;
}
struct ssl_client_hello* ssl_get_peek_result(void* result)
struct ssl_client_hello* ssl_get_peek_result(future_result_t* result)
{
struct ssl_client_hello* p=(struct ssl_client_hello* )result, *copy=NULL;
copy=ALLOC(struct ssl_client_hello*,1);

View File

@@ -457,7 +457,7 @@ void ssl_conn_origin_on_fail(enum e_future_error err, const char * what, void *
assert(0);
}
void peek_sni_on_succ(void * result, void * user)
void peek_client_hello_on_succ(void * result, void * user)
{
struct tfe_stream_private * _stream = (struct tfe_stream_private *) user;
assert(_stream->session_type == SESSION_PROTO_SSL);
@@ -475,7 +475,7 @@ void peek_sni_on_succ(void * result, void * user)
_stream->thrmgr_ref->evbase, NULL);
}
void peek_sni_on_fail(enum e_future_error err, const char * what, void * user)
void peek_client_hello_on_fail(enum e_future_error err, const char * what, void * user)
{
//TODO:
assert(0);
@@ -501,8 +501,8 @@ void tfe_stream_setup(struct tfe_stream_private * _stream)
case SESSION_PROTO_SSL:
// for SSL, defer dst connection setup to initial_readcb
_stream->ssl_downstream = ssl_downstream_create();
_stream->async_future = future_create(peek_sni_on_succ, peek_sni_on_fail, _stream);
ssl_async_peek_sni(_stream->ssl_downstream->future_sni_peek, _stream->fd_downstream,
_stream->async_future = future_create(peek_client_hello_on_succ, peek_client_hello_on_fail, _stream);
ssl_async_peek_client_hello(_stream->ssl_downstream->future_sni_peek, _stream->fd_downstream,
_stream->thrmgr_ref->evbase);
thread->stat.value[SSL_NUM]++;
break;