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 |
11 #include "webrtc/base/win32socketserver.h" | 11 #include "webrtc/base/win32socketserver.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <ws2tcpip.h> // NOLINT | 14 #include <ws2tcpip.h> // NOLINT |
15 | 15 |
16 #include "webrtc/base/byteorder.h" | 16 #include "webrtc/base/byteorder.h" |
| 17 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/common.h" | 18 #include "webrtc/base/common.h" |
18 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
19 #include "webrtc/base/win32window.h" | 20 #include "webrtc/base/win32window.h" |
20 #include "webrtc/base/winping.h" | 21 #include "webrtc/base/winping.h" |
21 | 22 |
22 namespace rtc { | 23 namespace rtc { |
23 | 24 |
24 /////////////////////////////////////////////////////////////////////////////// | 25 /////////////////////////////////////////////////////////////////////////////// |
25 // Win32Socket | 26 // Win32Socket |
26 /////////////////////////////////////////////////////////////////////////////// | 27 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 if (result == WinPing::PING_FAIL) { | 541 if (result == WinPing::PING_FAIL) { |
541 error_ = EINVAL; // can't think of a better error ID | 542 error_ = EINVAL; // can't think of a better error ID |
542 return -1; | 543 return -1; |
543 } | 544 } |
544 if (result != WinPing::PING_TOO_LARGE) { | 545 if (result != WinPing::PING_TOO_LARGE) { |
545 *mtu = PACKET_MAXIMUMS[level]; | 546 *mtu = PACKET_MAXIMUMS[level]; |
546 return 0; | 547 return 0; |
547 } | 548 } |
548 } | 549 } |
549 | 550 |
550 ASSERT(false); | 551 RTC_NOTREACHED(); |
551 return 0; | 552 return 0; |
552 } | 553 } |
553 | 554 |
554 void Win32Socket::CreateSink() { | 555 void Win32Socket::CreateSink() { |
555 ASSERT(NULL == sink_); | 556 ASSERT(NULL == sink_); |
556 | 557 |
557 // Create window | 558 // Create window |
558 sink_ = new EventSink(this); | 559 sink_ = new EventSink(this); |
559 sink_->Create(NULL, L"EventSink", 0, 0, 0, 0, 10, 10); | 560 sink_->Create(NULL, L"EventSink", 0, 0, 0, 0, 10, 10); |
560 } | 561 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 *sopt = SO_SNDBUF; | 612 *sopt = SO_SNDBUF; |
612 break; | 613 break; |
613 case OPT_NODELAY: | 614 case OPT_NODELAY: |
614 *slevel = IPPROTO_TCP; | 615 *slevel = IPPROTO_TCP; |
615 *sopt = TCP_NODELAY; | 616 *sopt = TCP_NODELAY; |
616 break; | 617 break; |
617 case OPT_DSCP: | 618 case OPT_DSCP: |
618 LOG(LS_WARNING) << "Socket::OPT_DSCP not supported."; | 619 LOG(LS_WARNING) << "Socket::OPT_DSCP not supported."; |
619 return -1; | 620 return -1; |
620 default: | 621 default: |
621 ASSERT(false); | 622 RTC_NOTREACHED(); |
622 return -1; | 623 return -1; |
623 } | 624 } |
624 return 0; | 625 return 0; |
625 } | 626 } |
626 | 627 |
627 void Win32Socket::OnSocketNotify(SOCKET socket, int event, int error) { | 628 void Win32Socket::OnSocketNotify(SOCKET socket, int event, int error) { |
628 // Ignore events if we're already closed. | 629 // Ignore events if we're already closed. |
629 if (socket != socket_) | 630 if (socket != socket_) |
630 return; | 631 return; |
631 | 632 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 bool handled = false; | 854 bool handled = false; |
854 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) { | 855 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) { |
855 ss_->Pump(); | 856 ss_->Pump(); |
856 lr = 0; | 857 lr = 0; |
857 handled = true; | 858 handled = true; |
858 } | 859 } |
859 return handled; | 860 return handled; |
860 } | 861 } |
861 | 862 |
862 } // namespace rtc | 863 } // namespace rtc |
OLD | NEW |