OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/socket/tcp_client_socket_libevent.h" | 5 #include "net/socket/tcp_client_socket_libevent.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <netdb.h> | 9 #include <netdb.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return OK; | 79 return OK; |
80 default: | 80 default: |
81 LOG(WARNING) << "Unknown error " << os_error | 81 LOG(WARNING) << "Unknown error " << os_error |
82 << " mapped to net::ERR_FAILED"; | 82 << " mapped to net::ERR_FAILED"; |
83 return ERR_FAILED; | 83 return ERR_FAILED; |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 int MapConnectError(int os_error) { | 87 int MapConnectError(int os_error) { |
88 switch (os_error) { | 88 switch (os_error) { |
| 89 case EACCES: |
| 90 return ERR_NETWORK_ACCESS_DENIED; |
89 case ETIMEDOUT: | 91 case ETIMEDOUT: |
90 return ERR_CONNECTION_TIMED_OUT; | 92 return ERR_CONNECTION_TIMED_OUT; |
91 default: { | 93 default: { |
92 int net_error = MapPosixError(os_error); | 94 int net_error = MapPosixError(os_error); |
93 if (net_error == ERR_FAILED) | 95 if (net_error == ERR_FAILED) |
94 return ERR_CONNECTION_FAILED; // More specific than ERR_FAILED. | 96 return ERR_CONNECTION_FAILED; // More specific than ERR_FAILED. |
95 | 97 |
96 // Give a more specific error when the user is offline. | 98 // Give a more specific error when the user is offline. |
97 if (net_error == ERR_ADDRESS_UNREACHABLE && | 99 if (net_error == ERR_ADDRESS_UNREACHABLE && |
98 NetworkChangeNotifier::IsOffline()) { | 100 NetworkChangeNotifier::IsOffline()) { |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 549 |
548 void TCPClientSocketLibevent::SetOmniboxSpeculation() { | 550 void TCPClientSocketLibevent::SetOmniboxSpeculation() { |
549 use_history_.set_omnibox_speculation(); | 551 use_history_.set_omnibox_speculation(); |
550 } | 552 } |
551 | 553 |
552 bool TCPClientSocketLibevent::WasEverUsed() const { | 554 bool TCPClientSocketLibevent::WasEverUsed() const { |
553 return use_history_.was_used_to_convey_data(); | 555 return use_history_.was_used_to_convey_data(); |
554 } | 556 } |
555 | 557 |
556 } // namespace net | 558 } // namespace net |
OLD | NEW |