summaryrefslogtreecommitdiffstats
path: root/net/udp/udp_socket_win.cc
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-21 00:40:05 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-21 00:40:05 +0000
commite68fafe04d29810cebe8d25554863b0cae4c1356 (patch)
treeec6482b7500d9ef6cecb160ebcdf3d54f25355ea /net/udp/udp_socket_win.cc
parentaf540a4511352caf66aa9292c2c743f5c2d74c12 (diff)
downloadchromium_src-e68fafe04d29810cebe8d25554863b0cae4c1356.zip
chromium_src-e68fafe04d29810cebe8d25554863b0cae4c1356.tar.gz
chromium_src-e68fafe04d29810cebe8d25554863b0cae4c1356.tar.bz2
Map posix error codes in bind better, and fix one windows mapping.
r=wtc BUG=330233 Review URL: https://codereview.chromium.org/101193008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/udp/udp_socket_win.cc')
-rw-r--r--net/udp/udp_socket_win.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc
index 17fec44..cd4ec4a 100644
--- a/net/udp/udp_socket_win.cc
+++ b/net/udp/udp_socket_win.cc
@@ -339,7 +339,7 @@ int UDPSocketWin::InternalConnect(const IPEndPoint& address) {
// else connect() does the DatagramSocket::DEFAULT_BIND
if (rv < 0) {
- UMA_HISTOGRAM_SPARSE_SLOWLY("Net.UdpSocketRandomBindErrorCode", rv);
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Net.UdpSocketRandomBindErrorCode", -rv);
Close();
return rv;
}
@@ -670,7 +670,12 @@ int UDPSocketWin::DoBind(const IPEndPoint& address) {
int last_error = WSAGetLastError();
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.UdpSocketBindErrorFromWinOS", last_error);
// Map some codes that are special to bind() separately.
- if (last_error == WSAEACCES || last_error == WSAEINVAL)
+ // * WSAEACCES: If a port is already bound to a socket, WSAEACCES may be
+ // returned instead of WSAEADDRINUSE, depending on whether the socket
+ // option SO_REUSEADDR or SO_EXCLUSIVEADDRUSE is set and whether the
+ // conflicting socket is owned by a different user account. See the MSDN
+ // page "Using SO_REUSEADDR and SO_EXCLUSIVEADDRUSE" for the gory details.
+ if (last_error == WSAEACCES || last_error == WSAEADDRNOTAVAIL)
return ERR_ADDRESS_IN_USE;
return MapSystemError(last_error);
}