Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1934)

Unified Diff: net/socket/unix_domain_client_socket_posix.cc

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/ssl_client_socket_pool_unittest.cc ('k') | net/spdy/spdy_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..70ad42baa0ec3af2d92053c47efd059b553850a3 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;
+
+ 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 {
« no previous file with comments | « net/socket/ssl_client_socket_pool_unittest.cc ('k') | net/spdy/spdy_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698