diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 18:58:37 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 18:58:37 +0000 |
commit | c53976d541527d07f2e71f32abf6646d73071b2e (patch) | |
tree | 7d1e88ac366d9b8a50821684d655c520696cd123 /net/socket/tcp_client_socket_libevent.cc | |
parent | 35506359934707a1dc47e0b26684a145835dd9c3 (diff) | |
download | chromium_src-c53976d541527d07f2e71f32abf6646d73071b2e.zip chromium_src-c53976d541527d07f2e71f32abf6646d73071b2e.tar.gz chromium_src-c53976d541527d07f2e71f32abf6646d73071b2e.tar.bz2 |
Add a new net::Error value: ERR_CONNECTION_TIMED_OUT.
TEST=net_unittests
BUG=none
Review URL: http://codereview.chromium.org/159904
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_libevent.cc')
-rw-r--r-- | net/socket/tcp_client_socket_libevent.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index a8e4387..c03473a 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -67,6 +67,15 @@ int MapPosixError(int err) { } } +int MapConnectError(int err) { + switch (err) { + case ETIMEDOUT: + return ERR_CONNECTION_TIMED_OUT; + default: + return MapPosixError(err); + } +} + } // namespace //----------------------------------------------------------------------------- @@ -115,7 +124,7 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) { DLOG(INFO) << "connect failed: " << errno; close(socket_); socket_ = kInvalidSocket; - return MapPosixError(errno); + return MapConnectError(errno); } // Initialize write_socket_watcher_ and link it to our MessagePump. @@ -309,7 +318,7 @@ void TCPClientSocketLibevent::DidCompleteConnect() { current_ai_ = next; result = Connect(write_callback_); } else { - result = MapPosixError(error_code); + result = MapConnectError(error_code); bool ok = write_socket_watcher_.StopWatchingFileDescriptor(); DCHECK(ok); waiting_connect_ = false; |