use getPeerIpAddPort insteed of getPeerIpaddr

connection_manager
YuQing 2020-03-26 11:37:32 +08:00
parent 17c51bce29
commit fcfe02896d
2 changed files with 4 additions and 5 deletions

View File

@ -291,7 +291,6 @@ int sf_load_context_from_config(SFContext *sf_context,
sf_context->outer_port = default_outer_port;
}
inner_bind_addr = iniGetStrValue(section_name,
"inner_bind_addr", pIniContext);
outer_bind_addr = iniGetStrValue(section_name,

View File

@ -318,10 +318,10 @@ static void *accept_thread_entrance(void *arg)
{
struct accept_thread_context *accept_context;
int incomesock;
int port;
struct sockaddr_in inaddr;
socklen_t sockaddr_len;
struct fast_task_info *task;
char szClientIp[IP_ADDRESS_SIZE];
accept_context = (struct accept_thread_context *)arg;
while (g_sf_global_vars.continue_flag) {
@ -338,8 +338,6 @@ static void *accept_thread_entrance(void *arg)
continue;
}
getPeerIpaddr(incomesock,
szClientIp, IP_ADDRESS_SIZE);
if (tcpsetnonblockopt(incomesock) != 0) {
close(incomesock);
continue;
@ -354,7 +352,9 @@ static void *accept_thread_entrance(void *arg)
close(incomesock);
continue;
}
strcpy(task->client_ip, szClientIp);
getPeerIpAddPort(incomesock, task->client_ip,
sizeof(task->client_ip), &port);
task->port = port;
task->canceled = false;
task->ctx = accept_context->sf_context;