summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2020-09-03 10:05:01 +0800
committerluwenpeng <[email protected]>2020-09-03 14:29:59 +0800
commit56addbdd278e1e1ec6cd6dabf4ebf005756e0ba2 (patch)
tree02961f06440d16490d71e2237305ad970088d60c
parent5302adb66aa00f543a99133cdc81be0492d13e2c (diff)
TSG-2612 修改 tcp options 的 debug 日志
-rw-r--r--platform/src/proxy.cpp12
1 files 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.",