修正stream_proto从cmsg读出的方式

This commit is contained in:
luqiuwen
2019-06-02 17:18:34 +08:00
parent 57f5a4d906
commit 7462a558c1
2 changed files with 6 additions and 4 deletions

View File

@@ -106,10 +106,11 @@ int tfe_proxy_fds_accept(struct tfe_proxy * ctx, int fd_downstream, int fd_upstr
struct tfe_stream * stream = tfe_stream_create(ctx, worker_thread_ctx);
enum tfe_stream_proto stream_protocol;
uint16_t __size;
uint8_t stream_protocol_in_char = 0;
uint16_t size = 0;
int result = tfe_cmsg_get_value(cmsg, TFE_CMSG_TCP_RESTORE_PROTOCOL, (unsigned char *)&stream_protocol,
sizeof(stream_protocol), &__size);
int result = tfe_cmsg_get_value(cmsg, TFE_CMSG_TCP_RESTORE_PROTOCOL, (unsigned char *)&stream_protocol_in_char,
sizeof(stream_protocol_in_char), &size);
if (unlikely(result < 0))
{
@@ -117,6 +118,7 @@ int tfe_proxy_fds_accept(struct tfe_proxy * ctx, int fd_downstream, int fd_upstr
goto __errout;
}
stream_protocol = (enum tfe_stream_proto)stream_protocol_in_char;
tfe_stream_option_set(stream, TFE_STREAM_OPT_SESSION_TYPE, &stream_protocol, sizeof(stream_protocol));
tfe_stream_cmsg_setup(stream, cmsg);