修复根据fd创建stream addr时源目的地址颠倒的问题。修复HTTP业务层IP扫描不命中问题。
This commit is contained in:
@@ -218,7 +218,8 @@ struct ssl_stream * ssl_stream_new(struct ssl_mgr * mgr, evutil_socket_t fd, enu
|
||||
s_stream->ssl = downstream_ssl_create(mgr, kyr);
|
||||
s_stream->keyring = kyr;
|
||||
break;
|
||||
case CONN_DIR_UPSTREAM: s_stream->ssl = upstream_ssl_create(mgr, client_hello, fd);
|
||||
case CONN_DIR_UPSTREAM:
|
||||
s_stream->ssl = upstream_ssl_create(mgr, client_hello, fd);
|
||||
s_stream->client_hello = client_hello;
|
||||
break;
|
||||
default: assert(0);
|
||||
@@ -618,16 +619,19 @@ static SSL * upstream_ssl_create(struct ssl_mgr * mgr, const struct ssl_chello *
|
||||
socklen_t addrlen = sizeof(struct sockaddr_storage);
|
||||
|
||||
ret = getpeername(fd, (struct sockaddr *) (&addr), &addrlen);
|
||||
assert(ret == 0);
|
||||
|
||||
/* session resuming based on remote endpoint address and port */
|
||||
sess = up_session_get(mgr->up_sess_cache, (struct sockaddr *) &addr, addrlen, chello->sni); /* new sess insert */
|
||||
if (sess)
|
||||
if(ret == 0)
|
||||
{
|
||||
SSL_set_session(ssl, sess); /* increments sess refcount */
|
||||
SSL_SESSION_free(sess);
|
||||
/* session resuming based on remote endpoint address and port */
|
||||
sess = up_session_get(mgr->up_sess_cache, (struct sockaddr *) &addr, addrlen, chello->sni);
|
||||
if (sess)
|
||||
{
|
||||
SSL_set_session(ssl, sess); /* increments sess refcount */
|
||||
SSL_SESSION_free(sess);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ssl;
|
||||
}
|
||||
|
||||
@@ -1275,9 +1279,9 @@ retry:
|
||||
|
||||
if (ctx->retries++ >= MAX_NET_RETRIES)
|
||||
{
|
||||
struct tfe_stream_addr* addr=tfe_stream_addr_create_by_fd(fd);
|
||||
struct tfe_stream_addr* addr=tfe_stream_addr_create_by_fd(fd, ctx->s_stream->dir);
|
||||
char* addr_string=tfe_stream_addr_to_str(addr);
|
||||
TFE_LOG_ERROR(logger, "Failed to shutdown SSL connection cleanly: %s"
|
||||
TFE_LOG_ERROR(logger, "Failed to shutdown SSL connection cleanly: %s "
|
||||
"Max retries reached. Closing fd %d.", addr_string, fd);
|
||||
tfe_stream_addr_free(addr);
|
||||
free(addr_string);
|
||||
|
||||
Reference in New Issue
Block a user