| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/net_errors.h" | 5 #include "net/base/net_errors.h" |
| 6 | 6 |
| 7 #include <winsock2.h> | 7 #include <winsock2.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 // Map winsock and system errors to Chromium errors. | 13 // Map winsock and system errors to Chromium errors. |
| 14 Error MapSystemError(int os_error) { | 14 Error MapSystemError(int os_error) { |
| 15 if (os_error != 0) |
| 16 DVLOG(2) << "Error " << os_error; |
| 17 |
| 15 // There are numerous Winsock error codes, but these are the ones we thus far | 18 // There are numerous Winsock error codes, but these are the ones we thus far |
| 16 // find interesting. | 19 // find interesting. |
| 17 switch (os_error) { | 20 switch (os_error) { |
| 18 case WSAEWOULDBLOCK: | 21 case WSAEWOULDBLOCK: |
| 19 return ERR_IO_PENDING; | 22 return ERR_IO_PENDING; |
| 20 case WSAEACCES: | 23 case WSAEACCES: |
| 21 return ERR_ACCESS_DENIED; | 24 return ERR_ACCESS_DENIED; |
| 22 case WSAENETDOWN: | 25 case WSAENETDOWN: |
| 23 return ERR_INTERNET_DISCONNECTED; | 26 return ERR_INTERNET_DISCONNECTED; |
| 24 case WSAETIMEDOUT: | 27 case WSAETIMEDOUT: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 case ERROR_SUCCESS: | 111 case ERROR_SUCCESS: |
| 109 return OK; | 112 return OK; |
| 110 default: | 113 default: |
| 111 LOG(WARNING) << "Unknown error " << os_error | 114 LOG(WARNING) << "Unknown error " << os_error |
| 112 << " mapped to net::ERR_FAILED"; | 115 << " mapped to net::ERR_FAILED"; |
| 113 return ERR_FAILED; | 116 return ERR_FAILED; |
| 114 } | 117 } |
| 115 } | 118 } |
| 116 | 119 |
| 117 } // namespace net | 120 } // namespace net |
| OLD | NEW |