For direction of getLocalAddress and getRemoteAddress.

This commit is contained in:
Sönke Ludwig 2017-03-24 09:04:32 +01:00
parent 420c361b5f
commit 872f1b12b9
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -216,7 +216,7 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
final override bool getLocalAddress(SocketFD sock, scope RefAddress dst)
{
socklen_t addr_len = dst.nameLen;
if (() @trusted { return getpeername(cast(sock_t)sock, dst.name, &addr_len); } () != 0)
if (() @trusted { return getsockname(cast(sock_t)sock, dst.name, &addr_len); } () != 0)
return false;
dst.cap(addr_len);
return true;
@ -225,7 +225,7 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
final override bool getRemoteAddress(SocketFD sock, scope RefAddress dst)
{
socklen_t addr_len = dst.nameLen;
if (() @trusted { return getsockname(cast(sock_t)sock, dst.name, &addr_len); } () != 0)
if (() @trusted { return getpeername(cast(sock_t)sock, dst.name, &addr_len); } () != 0)
return false;
dst.cap(addr_len);
return true;