| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 296, // Point-to-Point (low delay) | 48 296, // Point-to-Point (low delay) |
| 49 68, // Official minimum | 49 68, // Official minimum |
| 50 0, // End of list marker | 50 0, // End of list marker |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 static const int IP_HEADER_SIZE = 20u; | 53 static const int IP_HEADER_SIZE = 20u; |
| 54 static const int ICMP_HEADER_SIZE = 8u; | 54 static const int ICMP_HEADER_SIZE = 8u; |
| 55 static const int ICMP_PING_TIMEOUT_MILLIS = 10000u; | 55 static const int ICMP_PING_TIMEOUT_MILLIS = 10000u; |
| 56 | 56 |
| 57 // TODO: Enable for production builds also? Use FormatMessage? | 57 // TODO: Enable for production builds also? Use FormatMessage? |
| 58 #ifdef _DEBUG | 58 #if !defined(NDEBUG) |
| 59 LPCSTR WSAErrorToString(int error, LPCSTR *description_result) { | 59 LPCSTR WSAErrorToString(int error, LPCSTR *description_result) { |
| 60 LPCSTR string = "Unspecified"; | 60 LPCSTR string = "Unspecified"; |
| 61 LPCSTR description = "Unspecified description"; | 61 LPCSTR description = "Unspecified description"; |
| 62 switch (error) { | 62 switch (error) { |
| 63 case ERROR_SUCCESS: | 63 case ERROR_SUCCESS: |
| 64 string = "SUCCESS"; | 64 string = "SUCCESS"; |
| 65 description = "Operation succeeded"; | 65 description = "Operation succeeded"; |
| 66 break; | 66 break; |
| 67 case WSAEWOULDBLOCK: | 67 case WSAEWOULDBLOCK: |
| 68 string = "WSAEWOULDBLOCK"; | 68 string = "WSAEWOULDBLOCK"; |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 void Win32Socket::OnSocketNotify(SOCKET socket, int event, int error) { | 619 void Win32Socket::OnSocketNotify(SOCKET socket, int event, int error) { |
| 620 // Ignore events if we're already closed. | 620 // Ignore events if we're already closed. |
| 621 if (socket != socket_) | 621 if (socket != socket_) |
| 622 return; | 622 return; |
| 623 | 623 |
| 624 error_ = error; | 624 error_ = error; |
| 625 switch (event) { | 625 switch (event) { |
| 626 case FD_CONNECT: | 626 case FD_CONNECT: |
| 627 if (error != ERROR_SUCCESS) { | 627 if (error != ERROR_SUCCESS) { |
| 628 ReportWSAError("WSAAsync:connect notify", error, addr_); | 628 ReportWSAError("WSAAsync:connect notify", error, addr_); |
| 629 #ifdef _DEBUG | 629 #if !defined(NDEBUG) |
| 630 int32_t duration = TimeSince(connect_time_); | 630 int32_t duration = TimeSince(connect_time_); |
| 631 LOG(LS_INFO) << "WSAAsync:connect error (" << duration | 631 LOG(LS_INFO) << "WSAAsync:connect error (" << duration |
| 632 << " ms), faking close"; | 632 << " ms), faking close"; |
| 633 #endif | 633 #endif |
| 634 state_ = CS_CLOSED; | 634 state_ = CS_CLOSED; |
| 635 // If you get an error connecting, close doesn't really do anything | 635 // If you get an error connecting, close doesn't really do anything |
| 636 // and it certainly doesn't send back any close notification, but | 636 // and it certainly doesn't send back any close notification, but |
| 637 // we really only maintain a few states, so it is easiest to get | 637 // we really only maintain a few states, so it is easiest to get |
| 638 // back into a known state by pretending that a close happened, even | 638 // back into a known state by pretending that a close happened, even |
| 639 // though the connect event never did occur. | 639 // though the connect event never did occur. |
| 640 SignalCloseEvent(this, error); | 640 SignalCloseEvent(this, error); |
| 641 } else { | 641 } else { |
| 642 #ifdef _DEBUG | 642 #if !defined(NDEBUG) |
| 643 int32_t duration = TimeSince(connect_time_); | 643 int32_t duration = TimeSince(connect_time_); |
| 644 LOG(LS_INFO) << "WSAAsync:connect (" << duration << " ms)"; | 644 LOG(LS_INFO) << "WSAAsync:connect (" << duration << " ms)"; |
| 645 #endif | 645 #endif |
| 646 state_ = CS_CONNECTED; | 646 state_ = CS_CONNECTED; |
| 647 SignalConnectEvent(this); | 647 SignalConnectEvent(this); |
| 648 } | 648 } |
| 649 break; | 649 break; |
| 650 | 650 |
| 651 case FD_ACCEPT: | 651 case FD_ACCEPT: |
| 652 case FD_READ: | 652 case FD_READ: |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 bool handled = false; | 845 bool handled = false; |
| 846 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) { | 846 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) { |
| 847 ss_->Pump(); | 847 ss_->Pump(); |
| 848 lr = 0; | 848 lr = 0; |
| 849 handled = true; | 849 handled = true; |
| 850 } | 850 } |
| 851 return handled; | 851 return handled; |
| 852 } | 852 } |
| 853 | 853 |
| 854 } // namespace rtc | 854 } // namespace rtc |
| OLD | NEW |