Skip to content

Commit

Permalink
std.socket: Throw appropriate exception in local/remoteAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Sep 7, 2011
1 parent 4698949 commit 6d710cc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions std/socket.d
Original file line number Diff line number Diff line change
Expand Up @@ -2172,8 +2172,10 @@ public:
{
Address addr = createAddress();
socklen_t nameLen = addr.nameLen();
if(_SOCKET_ERROR == .getpeername(sock, addr.name(), &nameLen) || nameLen > addr.nameLen())
if(_SOCKET_ERROR == .getpeername(sock, addr.name(), &nameLen))
throw new SocketOSException("Unable to obtain remote socket address");
if(nameLen > addr.nameLen())
throw new SocketParameterException("Not enough socket address storage");
assert(addr.addressFamily() == _family);
return addr;
}
Expand All @@ -2183,8 +2185,10 @@ public:
{
Address addr = createAddress();
socklen_t nameLen = addr.nameLen();
if(_SOCKET_ERROR == .getsockname(sock, addr.name(), &nameLen) || nameLen > addr.nameLen())
if(_SOCKET_ERROR == .getsockname(sock, addr.name(), &nameLen))
throw new SocketOSException("Unable to obtain local socket address");
if(nameLen > addr.nameLen())
throw new SocketParameterException("Not enough socket address storage");
assert(addr.addressFamily() == _family);
return addr;
}
Expand Down

0 comments on commit 6d710cc

Please sign in to comment.