diff options
| author | luwenpeng <[email protected]> | 2022-12-29 18:16:52 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2022-12-29 18:16:52 +0800 |
| commit | 1e1214cf1209575bffac135ad073d5f81fc12617 (patch) | |
| tree | f929d4a820c61c9c5f964d6fb6e7a3733dc89dec | |
| parent | f2856eaa0b134876400bebf6f4d7f543e57f2e94 (diff) | |
Decrypted Traffic Steering功能启用时仍然支持Pinning检测和Pinning Dynamic Bypassv4.7.01-20221229
| -rw-r--r-- | platform/src/tcp_stream.cpp | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/platform/src/tcp_stream.cpp b/platform/src/tcp_stream.cpp index c60500c..aeccd8f 100644 --- a/platform/src/tcp_stream.cpp +++ b/platform/src/tcp_stream.cpp @@ -912,28 +912,7 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void * const char * str_conn_dir = __str_dir(conn_dir); enum tfe_conn_dir peer_conn_dir{}; size_t rx_offset = 0; - - if (steering_device_is_available() && ( - (STREAM_PROTO_PLAIN == _stream->session_type && _stream->proxy_ref->traffic_steering_options.enable_steering_http) || - (STREAM_PROTO_SSL == _stream->session_type &&_stream->proxy_ref->traffic_steering_options.enable_steering_ssl))) - { - TFE_LOG_DEBUG(__STREAM_LOGGER(_stream), "decrypted traffic steering, %s %s run eventcb, %s %s", - _stream->str_stream_addr, - bev == _stream->conn_downstream->bev ? "conn_downstream" : "conn_upstream", - bev_event_to_string(events), - errno_to_string(errno) - ); - if (events & BEV_EVENT_ERROR) - { - __stream_log_event(_stream, EVENT_LOG_CLOSE_BY_FD_ERROR, conn_dir, errno, errno_to_string(errno)); - } - if (events & BEV_EVENT_EOF) - { - __stream_log_event(_stream, EVENT_LOG_CLOSE_BY_FD_EOF, conn_dir, errno, errno_to_string(errno)); - } - tfe_stream_destory(_stream); - return; - } + int need_close_connection = 0; if (__bev_dir(_stream, bev) == CONN_DIR_UPSTREAM) { @@ -986,8 +965,6 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void * { TFE_LOG_INFO(g_default_logger, "%s %s connection error, errno = %d, %s", _stream->str_stream_addr, str_conn_dir, errno, strerror(errno)); - /* after log, reset errno */ - errno = 0; } } else if (events & BEV_EVENT_EOF && rx_offset == 0 && _stream->session_type == STREAM_PROTO_SSL) @@ -1005,6 +982,25 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void * __stream_log_event(_stream, EVENT_LOG_CLOSE_BY_FD_EOF, conn_dir, 0, NULL); } + need_close_connection = 1; + } + + if (steering_device_is_available() && ( + (STREAM_PROTO_PLAIN == _stream->session_type && _stream->proxy_ref->traffic_steering_options.enable_steering_http) || + (STREAM_PROTO_SSL == _stream->session_type &&_stream->proxy_ref->traffic_steering_options.enable_steering_ssl))) + { + TFE_LOG_DEBUG(__STREAM_LOGGER(_stream), "decrypted traffic steering, %s %s run eventcb, %s %s", + _stream->str_stream_addr, + bev == _stream->conn_downstream->bev ? "conn_downstream" : "conn_upstream", + bev_event_to_string(events), + errno_to_string(errno) + ); + tfe_stream_destory(_stream); + return; + } + + if (need_close_connection) + { goto __close_connection; } |
