From 56addbdd278e1e1ec6cd6dabf4ebf005756e0ba2 Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Thu, 3 Sep 2020 10:05:01 +0800 Subject: [PATCH] =?UTF-8?q?TSG-2612=20=E4=BF=AE=E6=94=B9=20tcp=20options?= =?UTF-8?q?=20=E7=9A=84=20debug=20=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/src/proxy.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/platform/src/proxy.cpp b/platform/src/proxy.cpp index 832b01b..82dcd33 100644 --- a/platform/src/proxy.cpp +++ b/platform/src/proxy.cpp @@ -159,7 +159,7 @@ int tfe_proxy_fds_accept(struct tfe_proxy * ctx, int fd_downstream, int fd_upstr enum tfe_stream_proto stream_protocol; uint8_t stream_protocol_in_char = 0; - int tcp_passthrough = 0; + int tcp_passthrough = -1; uint16_t size = 0; int result = tfe_cmsg_get_value(cmsg, TFE_CMSG_TCP_RESTORE_PROTOCOL, (unsigned char *)&stream_protocol_in_char, @@ -183,14 +183,10 @@ int tfe_proxy_fds_accept(struct tfe_proxy * ctx, int fd_downstream, int fd_upstr TFE_LOG_ERROR(ctx->logger, "failed at fetch connection's tcp_passthrough from cmsg: %s", strerror(-result)); // goto __errout; } - else - { - TFE_LOG_DEBUG(ctx->logger, "%p: fetch tcp options, passthrough: %d", stream, tcp_passthrough); - } } /* FOR DEBUG */ - if (unlikely(ctx->tcp_all_passthrough) || tcp_passthrough) + if (unlikely(ctx->tcp_all_passthrough) || tcp_passthrough > 0) { bool __true = true; enum tfe_stream_proto __session_type = STREAM_PROTO_PLAIN; @@ -198,8 +194,10 @@ int tfe_proxy_fds_accept(struct tfe_proxy * ctx, int fd_downstream, int fd_upstr tfe_stream_option_set(stream, TFE_STREAM_OPT_PASSTHROUGH, &__true, sizeof(__true)); tfe_stream_option_set(stream, TFE_STREAM_OPT_SESSION_TYPE, &__session_type, sizeof(__session_type)); } + TFE_LOG_DEBUG(ctx->logger, "%p: fetch tcp options: cmsg's tcp_passthrough: %d, conf's tcp_passthrough: %d, enalbe passthrough: %d", + stream, tcp_passthrough, ctx->tcp_all_passthrough, (ctx->tcp_all_passthrough > 0 || tcp_passthrough > 0) ? 1 : 0); - result = tfe_stream_init_by_fds(stream, fd_downstream, fd_upstream); + result = tfe_stream_init_by_fds(stream, fd_downstream, fd_upstream); if (result < 0) { TFE_LOG_ERROR(ctx->logger, "%p, Fds(downstream = %d, upstream = %d, type = %d) accept failed.",