| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 25 matching lines...) Expand all Loading... |
| 36 // Convert values from <errno.h> to values from "net/base/net_errors.h" | 36 // Convert values from <errno.h> to values from "net/base/net_errors.h" |
| 37 int MapPosixError(int err) { | 37 int MapPosixError(int err) { |
| 38 // There are numerous posix error codes, but these are the ones we thus far | 38 // There are numerous posix error codes, but these are the ones we thus far |
| 39 // find interesting. | 39 // find interesting. |
| 40 switch (err) { | 40 switch (err) { |
| 41 case EAGAIN: | 41 case EAGAIN: |
| 42 #if EWOULDBLOCK != EAGAIN | 42 #if EWOULDBLOCK != EAGAIN |
| 43 case EWOULDBLOCK: | 43 case EWOULDBLOCK: |
| 44 #endif | 44 #endif |
| 45 return ERR_IO_PENDING; | 45 return ERR_IO_PENDING; |
| 46 case EACCES: |
| 47 return ERR_ACCESS_DENIED; |
| 46 case ENETDOWN: | 48 case ENETDOWN: |
| 47 return ERR_INTERNET_DISCONNECTED; | 49 return ERR_INTERNET_DISCONNECTED; |
| 48 case ETIMEDOUT: | 50 case ETIMEDOUT: |
| 49 return ERR_TIMED_OUT; | 51 return ERR_TIMED_OUT; |
| 50 case ECONNRESET: | 52 case ECONNRESET: |
| 51 case ENETRESET: // Related to keep-alive | 53 case ENETRESET: // Related to keep-alive |
| 52 return ERR_CONNECTION_RESET; | 54 return ERR_CONNECTION_RESET; |
| 53 case ECONNABORTED: | 55 case ECONNABORTED: |
| 54 return ERR_CONNECTION_ABORTED; | 56 return ERR_CONNECTION_ABORTED; |
| 55 case ECONNREFUSED: | 57 case ECONNREFUSED: |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 DoWriteCallback(result); | 375 DoWriteCallback(result); |
| 374 } | 376 } |
| 375 } | 377 } |
| 376 | 378 |
| 377 int TCPClientSocketLibevent::GetPeerName(struct sockaddr *name, | 379 int TCPClientSocketLibevent::GetPeerName(struct sockaddr *name, |
| 378 socklen_t *namelen) { | 380 socklen_t *namelen) { |
| 379 return ::getpeername(socket_, name, namelen); | 381 return ::getpeername(socket_, name, namelen); |
| 380 } | 382 } |
| 381 | 383 |
| 382 } // namespace net | 384 } // namespace net |
| OLD | NEW |