Skip to content

Commit 96da591

Browse files
Barbaros Tokaoglumichalvasko
authored andcommitted
session BUGFIX get source host correctly on a pending socket
1 parent 2a2b6de commit 96da591

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/session_client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,8 +1722,8 @@ nc_sock_connect(const char *host, uint16_t port, int timeout_ms, struct nc_keepa
17221722
sock = sock_connect(timeout_ms, sock_pending, NULL, ka);
17231723

17241724
if (sock > 0) {
1725-
if (getsockname(sock, (struct sockaddr *)&saddr, &addr_len)) {
1726-
ERR(NULL, "getsockname failed (%s).", strerror(errno));
1725+
if (getpeername(sock, (struct sockaddr *)&saddr, &addr_len)) {
1726+
ERR(NULL, "getpeername failed (%s).", strerror(errno));
17271727
goto error;
17281728
}
17291729

0 commit comments

Comments
 (0)