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

Unified Diff: net/socket/tcp_client_socket_libevent.cc

Issue 159904: Add a new net::Error value: ERR_CONNECTION_TIMED_OUT. (Closed)
Patch Set: Use MapConnectError() for asynchronous case too. Created 11 years, 4 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/base/net_error_list.h ('k') | net/socket/tcp_client_socket_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_client_socket_libevent.cc
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index a8e438727e09f276c2d410027bef8f1082b63382..c03473a3767719c5ea80986c43b40b21df04c5df 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;
« no previous file with comments | « net/base/net_error_list.h ('k') | net/socket/tcp_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698