Fix getPeerAddr() getPeerAddr(): +sin6_addr (#6410)
This commit is contained in:
parent
dabe4aed86
commit
92d67262fb
1 changed files with 2 additions and 2 deletions
|
|
@ -498,7 +498,7 @@ proc getLocalAddr*(socket: SocketHandle, domain: Domain): (string, Port) =
|
||||||
# Cannot use INET6_ADDRSTRLEN here, because it's a C define.
|
# Cannot use INET6_ADDRSTRLEN here, because it's a C define.
|
||||||
var buf: array[64, char]
|
var buf: array[64, char]
|
||||||
if inet_ntop(name.sin6_family.cint,
|
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())
|
raiseOSError(osLastError())
|
||||||
result = ($buf, Port(nativesockets.ntohs(name.sin6_port)))
|
result = ($buf, Port(nativesockets.ntohs(name.sin6_port)))
|
||||||
else:
|
else:
|
||||||
|
|
@ -534,7 +534,7 @@ proc getPeerAddr*(socket: SocketHandle, domain: Domain): (string, Port) =
|
||||||
# Cannot use INET6_ADDRSTRLEN here, because it's a C define.
|
# Cannot use INET6_ADDRSTRLEN here, because it's a C define.
|
||||||
var buf: array[64, char]
|
var buf: array[64, char]
|
||||||
if inet_ntop(name.sin6_family.cint,
|
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())
|
raiseOSError(osLastError())
|
||||||
result = ($buf, Port(nativesockets.ntohs(name.sin6_port)))
|
result = ($buf, Port(nativesockets.ntohs(name.sin6_port)))
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue