🐞 fix(TSG-15212): 修复TFE_CMSG_SSL_INTERCEPT_STATE字段设置错误; 修复msgpack默写字段为空时, 增加默认值
This commit is contained in:
2
cache/test/cache_evbase_benchmark.cpp
vendored
2
cache/test/cache_evbase_benchmark.cpp
vendored
@@ -406,7 +406,7 @@ int main(int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
runtime_log = MESA_create_runtime_log_handle("./runtime.log", 10);
|
||||
runtime_log = (void *)MESA_create_runtime_log_handle("./runtime.log", 10);
|
||||
if(NULL==runtime_log)
|
||||
{
|
||||
return -1;
|
||||
|
||||
4
cache/test/cache_evbase_test.cpp
vendored
4
cache/test/cache_evbase_test.cpp
vendored
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
|
||||
|
||||
future_promise_library_init(NULL);
|
||||
|
||||
runtime_log = MESA_create_runtime_log_handle("./runtime.log", 10);
|
||||
runtime_log = (void *)MESA_create_runtime_log_handle("./runtime.log", 10);
|
||||
if(NULL==runtime_log)
|
||||
{
|
||||
return -1;
|
||||
@@ -314,7 +314,7 @@ int main(int argc, char **argv)
|
||||
}*/
|
||||
sleep(1);
|
||||
}
|
||||
if(runing_over==2) //GETʱ<54><CAB1>ʱɾ<CAB1><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(runing_over==2) //GETʱ<54><CAB1>ʱɾ<CAB1><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
2
cache/test/tango_cache_test.cpp
vendored
2
cache/test/tango_cache_test.cpp
vendored
@@ -414,7 +414,7 @@ int main(int crgc, char **arg)
|
||||
|
||||
future_promise_library_init(NULL);
|
||||
|
||||
runtime_log = MESA_create_runtime_log_handle("./runtime.log", 10);
|
||||
runtime_log = (void *)MESA_create_runtime_log_handle("./runtime.log", 10);
|
||||
if(NULL==runtime_log)
|
||||
{
|
||||
return -1;
|
||||
|
||||
@@ -50,14 +50,14 @@ extern bool g_print_to_stderr;
|
||||
|
||||
#define TFE_LOG_ERROR(handler, fmt, ...) \
|
||||
do { if(g_print_to_stderr) fprintf(stderr, fmt "\n" , ##__VA_ARGS__); \
|
||||
MESA_handle_runtime_log(handler, RLOG_LV_FATAL, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0)
|
||||
MESA_handle_runtime_log((struct log_handle_t *)handler, RLOG_LV_FATAL, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0)
|
||||
|
||||
#define TFE_LOG_INFO(handler, fmt, ...) \
|
||||
do { if(g_print_to_stderr) fprintf(stderr, fmt "\n", ##__VA_ARGS__); \
|
||||
MESA_handle_runtime_log(handler, RLOG_LV_INFO, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
MESA_handle_runtime_log((struct log_handle_t *)handler, RLOG_LV_INFO, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
|
||||
#define TFE_LOG_DEBUG(handler, fmt, ...) \
|
||||
do { MESA_handle_runtime_log(handler, RLOG_LV_DEBUG, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
do { MESA_handle_runtime_log((struct log_handle_t *)handler, RLOG_LV_DEBUG, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
|
||||
#define CHECK_OR_EXIT(condition, fmt, ...) \
|
||||
do { if(!(condition)) { TFE_LOG_ERROR(g_default_logger, fmt, ##__VA_ARGS__); exit(EXIT_FAILURE); } } while(0) \
|
||||
|
||||
@@ -79,14 +79,20 @@ struct mpack_mmap_id2type
|
||||
|
||||
static int fqdn_id_set_cmsg(struct ctrl_pkt_parser *handler, mpack_node_t node, int table_index)
|
||||
{
|
||||
char empty_str[4] = {0};
|
||||
uint32_t fqdn_val[8] = {0};
|
||||
|
||||
uint32_t array_cnt = mpack_node_array_length(node);
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_NUM, (const unsigned char *)&array_cnt, sizeof(uint32_t));
|
||||
for (uint32_t i = 0; i < array_cnt; i++) {
|
||||
fqdn_val[i] = mpack_node_u32(mpack_node_array_at(node, i));
|
||||
if (array_cnt > 0) {
|
||||
for (uint32_t i = 0; i < array_cnt; i++) {
|
||||
fqdn_val[i] = mpack_node_u32(mpack_node_array_at(node, i));
|
||||
}
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char*)fqdn_val, array_cnt * sizeof(uint32_t));
|
||||
}
|
||||
else {
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char *)empty_str, 0);
|
||||
}
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char*)fqdn_val, array_cnt * sizeof(uint32_t));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -124,6 +130,7 @@ static int proxy_parse_messagepack(mpack_node_t node, void *ctx, void *logger)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t value = 0;
|
||||
char empty_str[4] = {0};
|
||||
char cmsg_str[256] = {0};
|
||||
struct ctrl_pkt_parser *handler = (struct ctrl_pkt_parser *)ctx;
|
||||
|
||||
@@ -152,10 +159,11 @@ static int proxy_parse_messagepack(mpack_node_t node, void *ctx, void *logger)
|
||||
tfe_cmsg_set(handler->cmsg, mpack_table[i].type, (const unsigned char *)&value, mpack_table[i].size);
|
||||
break;
|
||||
case mpack_type_str:
|
||||
snprintf(cmsg_str, sizeof(cmsg_str), mpack_node_str(ptr), mpack_node_strlen(ptr));
|
||||
mpack_node_copy_cstr(ptr, cmsg_str, sizeof(cmsg_str));
|
||||
tfe_cmsg_set(handler->cmsg, mpack_table[i].type, (const unsigned char *)cmsg_str, mpack_node_strlen(ptr));
|
||||
break;
|
||||
case mpack_type_nil:
|
||||
tfe_cmsg_set(handler->cmsg, mpack_table[i].type, (const unsigned char *)empty_str, 0);
|
||||
break;
|
||||
case mpack_type_array:
|
||||
switch(mpack_table[i].array_index)
|
||||
|
||||
@@ -163,7 +163,7 @@ error_out:
|
||||
struct acceptor_kni_v4 *acceptor_kni_v4_create(struct tfe_proxy *proxy, const char *profile)
|
||||
{
|
||||
void *packet_io_logger = NULL;
|
||||
packet_io_logger = MESA_create_runtime_log_handle("packet_io", RLOG_LV_DEBUG);
|
||||
packet_io_logger = (void *)MESA_create_runtime_log_handle("packet_io", RLOG_LV_DEBUG);
|
||||
assert(packet_io_logger != NULL);
|
||||
|
||||
g_packet_io_logger = packet_io_logger;
|
||||
|
||||
@@ -621,7 +621,7 @@ int main(int argc, char * argv[])
|
||||
/* adds locking, only required if accessed from separate threads */
|
||||
evthread_use_pthreads();
|
||||
|
||||
g_default_logger = MESA_create_runtime_log_handle("tfe", RLOG_LV_DEBUG);
|
||||
g_default_logger = (void *)MESA_create_runtime_log_handle("tfe", RLOG_LV_DEBUG);
|
||||
if (unlikely(g_default_logger == NULL))
|
||||
{
|
||||
TFE_LOG_ERROR(g_default_logger, "Failed at creating default logger: %s", "log/tfe.log");
|
||||
|
||||
@@ -1488,7 +1488,7 @@ static void peek_chello_on_succ(future_result_t * result, void * user)
|
||||
TFE_LOG_ERROR(ctx->mgr->logger, "CertStore is unavailable, PASSTHROUGH");
|
||||
}
|
||||
|
||||
ssl_stream_set_cmsg_integer(s_stream, TFE_CMSG_SSL_INTERCEPT_STATE, s_stream->up_parts.action);
|
||||
ssl_stream_set_cmsg_uint8(s_stream, TFE_CMSG_SSL_INTERCEPT_STATE, s_stream->up_parts.action);
|
||||
ctx->s_stream = s_stream;
|
||||
if(s_stream->up_parts.action==SSL_ACTION_PASSTHROUGH)
|
||||
{
|
||||
|
||||
@@ -1344,7 +1344,7 @@ void __stream_access_log_write(struct tfe_stream_private * stream)
|
||||
"%s/%s/%s ", __str_stream_log_type(ev_log->type), str_dir, ev_log->str_error);
|
||||
}
|
||||
|
||||
MESA_handle_runtime_log(stream->stream_logger, RLOG_LV_INFO, "access",
|
||||
TFE_LOG_INFO(stream->stream_logger, RLOG_LV_INFO, "access",
|
||||
"%d %d %d %s %s %s %s %s %s", stream->log_fd_downstream, stream->log_fd_upstream, stream->keyring_id,
|
||||
stream->str_stream_addr, str_passthrough, str_kill, str_log_event,
|
||||
stream->ssl_downstream_info_dump, stream->ssl_upstream_info_dump);
|
||||
@@ -1889,7 +1889,7 @@ void tfe_stream_write_access_log(const struct tfe_stream * stream, int level, co
|
||||
vasprintf(&__tmp_buffer, fmt, arg_ptr);
|
||||
|
||||
/* Log content with stream tag */
|
||||
MESA_handle_runtime_log(_stream->stream_logger, level, "access", "%s %s", _stream->str_stream_addr, __tmp_buffer);
|
||||
TFE_LOG_INFO(_stream->stream_logger, RLOG_LV_INFO, "access", "%s %s", _stream->str_stream_addr, __tmp_buffer);
|
||||
free(__tmp_buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ int main()
|
||||
unsigned int cert_store_port;
|
||||
future_promise_library_init(NULL);
|
||||
//const char* file_path = "./log/test_tfe_rpc.log",*host="localhost";
|
||||
//void * logger = MESA_create_runtime_log_handle(file_path, RLOG_LV_INFO);
|
||||
//void * logger = (void *)MESA_create_runtime_log_handle(file_path, RLOG_LV_INFO);
|
||||
const char* profile = "./conf/tfe.conf";
|
||||
const char* section = "key_keeper";
|
||||
int keyring_id = 0;
|
||||
|
||||
@@ -679,7 +679,7 @@ int doh_on_init(struct tfe_proxy *proxy)
|
||||
TFE_LOG_INFO(NULL, "Doh enabled.");
|
||||
|
||||
g_doh_conf->thread_num = tfe_proxy_get_work_thread_count();
|
||||
g_doh_conf->local_logger = MESA_create_runtime_log_handle("doh", RLOG_LV_DEBUG);
|
||||
g_doh_conf->local_logger = (void *)MESA_create_runtime_log_handle("doh", RLOG_LV_DEBUG);
|
||||
|
||||
g_doh_conf->gc_evbase = tfe_proxy_get_gc_evbase();
|
||||
g_doh_conf->fs_handle = tfe_proxy_get_fs_handle();
|
||||
|
||||
@@ -1161,7 +1161,7 @@ int proxy_http_init(struct tfe_proxy * proxy)
|
||||
g_proxy_rt->thread_num = tfe_proxy_get_work_thread_count();
|
||||
g_proxy_rt->gc_evbase=tfe_proxy_get_gc_evbase();
|
||||
|
||||
g_proxy_rt->local_logger = MESA_create_runtime_log_handle("tsg_http", RLOG_LV_DEBUG);
|
||||
g_proxy_rt->local_logger = (void *)MESA_create_runtime_log_handle("tsg_http", RLOG_LV_DEBUG);
|
||||
|
||||
g_proxy_rt->send_logger = proxy_log_handle_create(profile_path, "LOG", g_proxy_rt->local_logger);
|
||||
if (!g_proxy_rt->send_logger)
|
||||
|
||||
@@ -89,7 +89,7 @@ int http_plugin_init(struct tfe_proxy * proxy)
|
||||
plugin_ctx->gc_event_hs_private[thread_id] = gc_event;
|
||||
}
|
||||
|
||||
plugin_ctx->logger = MESA_create_runtime_log_handle("http", RLOG_LV_DEBUG);
|
||||
plugin_ctx->logger = (void *)MESA_create_runtime_log_handle("http", RLOG_LV_DEBUG);
|
||||
assert(plugin_ctx->logger != NULL);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ struct event_timer_ctx
|
||||
void load_logging_conf(const char *config)
|
||||
{
|
||||
RTLogInit2Data *logging_sc_lid = logger();
|
||||
logging_sc_lid->handle = MESA_create_runtime_log_handle("http2", RLOG_LV_DEBUG);
|
||||
logging_sc_lid->handle = (void *)MESA_create_runtime_log_handle("http2", RLOG_LV_DEBUG);
|
||||
if(logging_sc_lid->handle == NULL){
|
||||
TFE_LOG_ERROR(logging_sc_lid->handle, "Create log runtime_log_handle error, init failed!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user