Chromium Code Reviews| Index: net/socket/unix_domain_client_socket_posix.cc |
| diff --git a/net/socket/unix_domain_client_socket_posix.cc b/net/socket/unix_domain_client_socket_posix.cc |
| index 5adbca9979e21513886fa8123c9935d566b0bcc1..23ab6897b4ec6f8d0596638d0cbc67225122021e 100644 |
| --- a/net/socket/unix_domain_client_socket_posix.cc |
| +++ b/net/socket/unix_domain_client_socket_posix.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/logging.h" |
| #include "base/posix/eintr_wrapper.h" |
| +#include "net/base/ip_endpoint.h" |
| #include "net/base/net_errors.h" |
| #include "net/base/net_util.h" |
| #include "net/socket/socket_libevent.h" |
| @@ -98,13 +99,25 @@ bool UnixDomainClientSocket::IsConnectedAndIdle() const { |
| } |
| int UnixDomainClientSocket::GetPeerAddress(IPEndPoint* address) const { |
| - NOTIMPLEMENTED(); |
| - return ERR_NOT_IMPLEMENTED; |
| + // Unix domain sockets have no valid associated addr/port; |
| + // return either not connected or address invalid. |
| + DCHECK(address); |
| + |
| + if (!IsConnected()) { |
| + return ERR_SOCKET_NOT_CONNECTED; |
| + } |
|
mmenke
2015/01/08 18:15:53
nit: Don't use braces for if's when both the "if"
|
| + return ERR_ADDRESS_INVALID; |
| } |
| int UnixDomainClientSocket::GetLocalAddress(IPEndPoint* address) const { |
| - NOTIMPLEMENTED(); |
| - return ERR_NOT_IMPLEMENTED; |
| + // Unix domain sockets have no valid associated addr/port; |
| + // return either not connected or address invalid. |
| + DCHECK(address); |
| + |
| + if (!socket_) { |
| + return ERR_SOCKET_NOT_CONNECTED; |
| + } |
|
mmenke
2015/01/08 18:15:53
nit: Remove braces.
|
| + return ERR_ADDRESS_INVALID; |
| } |
| const BoundNetLog& UnixDomainClientSocket::NetLog() const { |