summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorwt <iwangtongi@163.com>2017-09-21 16:22:34 +0800
committerAndreas Rumpf <rumpf_a@web.de>2017-09-21 10:22:34 +0200
commit92d67262fb4969d6ecd2f122c9ee14155abf75c3 (patch)
tree263e4c5fad6e915eb705c5ef96e3168bd52db1fb /lib/pure
parentdabe4aed8663db0b2e242df1d2945fd9dd6abee0 (diff)
downloadNim-92d67262fb4969d6ecd2f122c9ee14155abf75c3.tar.gz
Fix `getPeerAddr()` `getPeerAddr()`: +`sin6_addr` (#6410)
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/nativesockets.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/nativesockets.nim b/lib/pure/nativesockets.nim
index 1a62c0bf6..98fc62a3b 100644
--- a/lib/pure/nativesockets.nim
+++ b/lib/pure/nativesockets.nim
@@ -498,7 +498,7 @@ proc getLocalAddr*(socket: SocketHandle, domain: Domain): (string, Port) =
     # Cannot use INET6_ADDRSTRLEN here, because it's a C define.
     var buf: array[64, char]
     if inet_ntop(name.sin6_family.cint,
-                 addr name, buf.cstring, sizeof(buf).int32).isNil:
+                 addr name.sin6_addr, buf.cstring, sizeof(buf).int32).isNil:
       raiseOSError(osLastError())
     result = ($buf, Port(nativesockets.ntohs(name.sin6_port)))
   else:
@@ -534,7 +534,7 @@ proc getPeerAddr*(socket: SocketHandle, domain: Domain): (string, Port) =
     # Cannot use INET6_ADDRSTRLEN here, because it's a C define.
     var buf: array[64, char]
     if inet_ntop(name.sin6_family.cint,
-                 addr name, buf.cstring, sizeof(buf).int32).isNil:
+                 addr name.sin6_addr, buf.cstring, sizeof(buf).int32).isNil:
       raiseOSError(osLastError())
     result = ($buf, Port(nativesockets.ntohs(name.sin6_port)))
   else: