修改future-promise接口,准备增加性能调试功能。

This commit is contained in:
zhengchao
2018-09-02 15:46:39 +08:00
parent baa409ecc8
commit f43e917308
5 changed files with 65 additions and 16 deletions

View File

@@ -23,6 +23,7 @@
#include <MESA/MESA_handle_logger.h>
#include <tfe_utils.h>
#include <tfe_future.h>
#include <tfe_stream.h>
#include <platform.h>
#include <proxy.h>
@@ -196,7 +197,8 @@ int main(int argc, char *argv[])
TFE_LOG_ERROR(g_default_logger, "Failed at creating default logger: %s", "log/tfe.log");
exit(EXIT_FAILURE);
}
future_promise_library_init();
/* PROXY INSTANCE */
g_default_proxy = ALLOC(struct tfe_proxy, 1);
assert(g_default_proxy);

View File

@@ -378,7 +378,12 @@ struct ssl_mgr * ssl_manager_init(const char * ini_profile, const char * section
TFE_LOG_ERROR(logger, "Unsupported SSL/TLS protocol %s", version_str);
goto error_out;
}
ret=ssl_init();
if(ret<0)
{
TFE_LOG_ERROR(logger, "OpenSSL global init failed.");
goto error_out;
}
//tfe2a uses SSLv23_method, it was been deprecated and replaced with the TLS_method() in openssl 1.1.0.
mgr->sslmethod = TLS_method;
MESA_load_profile_uint_def(ini_profile, section, "ssl_compression", &(mgr->sslcomp), 1);
@@ -853,7 +858,7 @@ extern void ssl_async_upstream_create(struct future * f, struct ssl_mgr * mgr, e
ctx->mgr = mgr;
promise_set_ctx(p, ctx, ssl_connect_origin_ctx_free);
ctx->f_peek_chello = future_create(peek_chello_on_succ, peek_chello_on_fail, p);
ctx->f_peek_chello = future_create("peek_sni", peek_chello_on_succ, peek_chello_on_fail, p);
ssl_async_peek_client_hello(ctx->f_peek_chello, fd_downstream, evbase, mgr->logger);
}
@@ -1188,7 +1193,7 @@ void ssl_async_downstream_create(struct future * f, struct ssl_mgr * mgr, struct
{
ATOMIC_INC(&(mgr->stat_val[SSL_FAKE_CRT]));
}
ctx->f_query_cert = future_create(ask_keyring_on_succ, ask_keyring_on_fail, p);
ctx->f_query_cert = future_create("ask_kyr",ask_keyring_on_succ, ask_keyring_on_fail, p);
key_keeper_async_ask(ctx->f_query_cert, mgr->keeper_of_keys, keyring_id, ctx->origin_crt, ctx->is_origin_crt_vaild,
evbase);
return;

View File

@@ -518,7 +518,7 @@ void ssl_upstream_create_on_success(future_result_t * result, void * user)
_stream->defer_fd_upstream = 0;
/* Next, create downstream */
_stream->future_downstream_create = future_create(ssl_downstream_create_on_success,
_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,
@@ -617,7 +617,7 @@ void tfe_stream_init_by_fds(struct tfe_stream * stream, evutil_socket_t fd_downs
{
_stream->ssl_mgr = _stream->proxy_ref->ssl_mgr_handler;
_stream->future_upstream_create = future_create(
_stream->future_upstream_create = future_create("ssl_up",
ssl_upstream_create_on_success, ssl_upstream_create_on_fail, (void *) _stream);
/* Defer setup conn_downstream & conn_upstream in async callbacks. */