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.",