Fix tcp local address issue

This commit is contained in:
Nick Peng
2019-09-08 13:50:54 +08:00
parent add8eecead
commit 640efd7b86
3 changed files with 45 additions and 1 deletions

View File

@@ -2342,7 +2342,7 @@ static int _dns_server_tcp_accept(struct dns_server_conn_tcp_server *tcpserver,
return -1;
}
if (getsockname(tcpclient->head.fd, (struct sockaddr *)&tcpclient->localaddr, &tcpclient->localaddr_len) != 0) {
if (getsocknet_inet(tcpclient->head.fd, (struct sockaddr *)&tcpclient->localaddr, &tcpclient->localaddr_len) != 0) {
tlog(TLOG_ERROR, "get local addr failed, %s", strerror(errno));
goto errout;
}