diff options
author | ikarienator@chromium.org <ikarienator@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-01 21:18:07 +0000 |
---|---|---|
committer | ikarienator@chromium.org <ikarienator@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-01 21:18:07 +0000 |
commit | bd2e3758a392e3480d976101007fb4285771cf38 (patch) | |
tree | 74973c11e57a6fb686f5a489b9575e98e3cae6d9 /net | |
parent | 2562218e74d2a1d29c72ea4bbd372c0fcfc68205 (diff) | |
download | chromium_src-bd2e3758a392e3480d976101007fb4285771cf38.zip chromium_src-bd2e3758a392e3480d976101007fb4285771cf38.tar.gz chromium_src-bd2e3758a392e3480d976101007fb4285771cf38.tar.bz2 |
Adding ERR_SOCKET_IS_CONNECTED.
BUG=235066
Review URL: https://chromiumcodereview.appspot.com/14666002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197713 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/net_error_list.h | 3 | ||||
-rw-r--r-- | net/base/net_errors_posix.cc | 2 | ||||
-rw-r--r-- | net/base/net_errors_win.cc | 2 | ||||
-rw-r--r-- | net/udp/udp_socket_libevent.cc | 6 | ||||
-rw-r--r-- | net/udp/udp_socket_win.cc | 6 |
5 files changed, 13 insertions, 6 deletions
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h index ff6e347..5afb522 100644 --- a/net/base/net_error_list.h +++ b/net/base/net_error_list.h @@ -91,6 +91,9 @@ NET_ERROR(NETWORK_CHANGED, -21) // administrator. NET_ERROR(BLOCKED_BY_ADMINISTRATOR, -22) +// The socket is already connected. +NET_ERROR(SOCKET_IS_CONNECTED, -23) + // A connection was closed (corresponding to a TCP FIN). NET_ERROR(CONNECTION_CLOSED, -100) diff --git a/net/base/net_errors_posix.cc b/net/base/net_errors_posix.cc index 8e9c7d5..3491b11 100644 --- a/net/base/net_errors_posix.cc +++ b/net/base/net_errors_posix.cc @@ -51,6 +51,8 @@ Error MapSystemError(int os_error) { return ERR_MSG_TOO_BIG; case ENOTCONN: return ERR_SOCKET_NOT_CONNECTED; + case EISCONN: + return ERR_SOCKET_IS_CONNECTED; case EINVAL: return ERR_INVALID_ARGUMENT; case EADDRINUSE: diff --git a/net/base/net_errors_win.cc b/net/base/net_errors_win.cc index c56225f..2cde82f4d 100644 --- a/net/base/net_errors_win.cc +++ b/net/base/net_errors_win.cc @@ -37,6 +37,8 @@ Error MapSystemError(int os_error) { case WSA_IO_INCOMPLETE: case WSAEDISCON: return ERR_CONNECTION_CLOSED; + case WSAEISCONN: + return ERR_SOCKET_IS_CONNECTED; case WSAEHOSTUNREACH: case WSAENETUNREACH: return ERR_ADDRESS_UNREACHABLE; diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc index f713786..4520c47 100644 --- a/net/udp/udp_socket_libevent.cc +++ b/net/udp/udp_socket_libevent.cc @@ -522,7 +522,7 @@ int UDPSocketLibevent::SetSocketOptions() { int UDPSocketLibevent::DoBind(const IPEndPoint& address) { SockaddrStorage storage; if (!address.ToSockAddr(storage.addr, &storage.addr_len)) - return ERR_UNEXPECTED; + return ERR_ADDRESS_INVALID; int rv = bind(socket_, storage.addr, storage.addr_len); return rv < 0 ? MapSystemError(errno) : rv; } @@ -617,7 +617,7 @@ int UDPSocketLibevent::LeaveGroup(const IPAddressNumber& group_address) const { int UDPSocketLibevent::SetMulticastTimeToLive(int time_to_live) { DCHECK(CalledOnValidThread()); if (is_connected()) - return ERR_UNEXPECTED; + return ERR_SOCKET_IS_CONNECTED; if (time_to_live < 0 || time_to_live > 255) return ERR_INVALID_ARGUMENT; @@ -628,7 +628,7 @@ int UDPSocketLibevent::SetMulticastTimeToLive(int time_to_live) { int UDPSocketLibevent::SetMulticastLoopbackMode(bool loopback) { DCHECK(CalledOnValidThread()); if (is_connected()) - return ERR_UNEXPECTED; + return ERR_SOCKET_IS_CONNECTED; if (loopback) socket_options_ |= SOCKET_OPTION_MULTICAST_LOOP; diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc index b1c5846..c3fd561 100644 --- a/net/udp/udp_socket_win.cc +++ b/net/udp/udp_socket_win.cc @@ -615,7 +615,7 @@ int UDPSocketWin::SetSocketOptions() { int UDPSocketWin::DoBind(const IPEndPoint& address) { SockaddrStorage storage; if (!address.ToSockAddr(storage.addr, &storage.addr_len)) - return ERR_UNEXPECTED; + return ERR_ADDRESS_INVALID; int rv = bind(socket_, storage.addr, storage.addr_len); return rv < 0 ? MapSystemError(WSAGetLastError()) : rv; } @@ -720,7 +720,7 @@ int UDPSocketWin::LeaveGroup( int UDPSocketWin::SetMulticastTimeToLive(int time_to_live) { DCHECK(CalledOnValidThread()); if (is_connected()) - return ERR_UNEXPECTED; + return ERR_SOCKET_IS_CONNECTED; if (time_to_live < 0 || time_to_live > 255) return ERR_INVALID_ARGUMENT; @@ -731,7 +731,7 @@ int UDPSocketWin::SetMulticastTimeToLive(int time_to_live) { int UDPSocketWin::SetMulticastLoopbackMode(bool loopback) { DCHECK(CalledOnValidThread()); if (is_connected()) - return ERR_UNEXPECTED; + return ERR_SOCKET_IS_CONNECTED; if (loopback) socket_options_ |= SOCKET_OPTION_MULTICAST_LOOP; |