| 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(logging::SystemErrorCode os_error) { |
| 15 if (os_error != 0) | 15 if (os_error != 0) |
| 16 DVLOG(2) << "Error " << os_error; | 16 DVLOG(2) << "Error " << os_error; |
| 17 | 17 |
| 18 // 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 |
| 19 // find interesting. | 19 // find interesting. |
| 20 switch (os_error) { | 20 switch (os_error) { |
| 21 case WSAEWOULDBLOCK: | 21 case WSAEWOULDBLOCK: |
| 22 case WSA_IO_PENDING: | 22 case WSA_IO_PENDING: |
| 23 return ERR_IO_PENDING; | 23 return ERR_IO_PENDING; |
| 24 case WSAEACCES: | 24 case WSAEACCES: |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 case ERROR_SUCCESS: | 116 case ERROR_SUCCESS: |
| 117 return OK; | 117 return OK; |
| 118 default: | 118 default: |
| 119 LOG(WARNING) << "Unknown error " << os_error | 119 LOG(WARNING) << "Unknown error " << os_error |
| 120 << " mapped to net::ERR_FAILED"; | 120 << " mapped to net::ERR_FAILED"; |
| 121 return ERR_FAILED; | 121 return ERR_FAILED; |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace net | 125 } // namespace net |
| OLD | NEW |