Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #223 from wuhengzhi/master
Browse files Browse the repository at this point in the history
[Temp] Make unix socket Get{Peer|Local}Address return more rational errors.
  • Loading branch information
rakuco committed Jan 9, 2015
2 parents 5c8891d + 44a8a9c commit 13ee6cc
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions net/socket/unix_domain_client_socket_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

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;

return ERR_ADDRESS_INVALID;
}

const BoundNetLog& UnixDomainClientSocket::NetLog() const {
Expand Down

0 comments on commit 13ee6cc

Please sign in to comment.