Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: webrtc/base/win32socketserver.cc

Issue 2866183004: Deleted unused method EstimateMTU, and the WinPing class. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/win32socketserver.h ('k') | webrtc/base/winping.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/checks.h"
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/base/win32window.h" 19 #include "webrtc/base/win32window.h"
20 #include "webrtc/base/winping.h"
21 20
22 namespace rtc { 21 namespace rtc {
23 22
24 /////////////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////////////
25 // Win32Socket 24 // Win32Socket
26 /////////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////////
27 26
28 // TODO: Move this to a common place where PhysicalSocketServer can 27 // TODO: Move this to a common place where PhysicalSocketServer can
29 // share it. 28 // share it.
30 // Standard MTUs 29 // Standard MTUs
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 } 517 }
519 if (sink_) { 518 if (sink_) {
520 sink_->Dispose(); 519 sink_->Dispose();
521 sink_ = nullptr; 520 sink_ = nullptr;
522 } 521 }
523 addr_.Clear(); 522 addr_.Clear();
524 state_ = CS_CLOSED; 523 state_ = CS_CLOSED;
525 return err; 524 return err;
526 } 525 }
527 526
528 int Win32Socket::EstimateMTU(uint16_t* mtu) {
529 SocketAddress addr = GetRemoteAddress();
530 if (addr.IsAnyIP()) {
531 error_ = ENOTCONN;
532 return -1;
533 }
534
535 WinPing ping;
536 if (!ping.IsValid()) {
537 error_ = EINVAL; // can't think of a better error ID
538 return -1;
539 }
540
541 for (int level = 0; PACKET_MAXIMUMS[level + 1] > 0; ++level) {
542 int32_t size = PACKET_MAXIMUMS[level] - IP_HEADER_SIZE - ICMP_HEADER_SIZE;
543 WinPing::PingResult result = ping.Ping(addr.ipaddr(), size,
544 ICMP_PING_TIMEOUT_MILLIS, 1, false);
545 if (result == WinPing::PING_FAIL) {
546 error_ = EINVAL; // can't think of a better error ID
547 return -1;
548 }
549 if (result != WinPing::PING_TOO_LARGE) {
550 *mtu = PACKET_MAXIMUMS[level];
551 return 0;
552 }
553 }
554
555 RTC_NOTREACHED();
556 return 0;
557 }
558
559 void Win32Socket::CreateSink() { 527 void Win32Socket::CreateSink() {
560 RTC_DCHECK(nullptr == sink_); 528 RTC_DCHECK(nullptr == sink_);
561 529
562 // Create window 530 // Create window
563 sink_ = new EventSink(this); 531 sink_ = new EventSink(this);
564 sink_->Create(nullptr, L"EventSink", 0, 0, 0, 0, 10, 10); 532 sink_->Create(nullptr, L"EventSink", 0, 0, 0, 0, 10, 10);
565 } 533 }
566 534
567 bool Win32Socket::SetAsync(int events) { 535 bool Win32Socket::SetAsync(int events) {
568 if (nullptr == sink_) { 536 if (nullptr == sink_) {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 bool handled = false; 825 bool handled = false;
858 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) { 826 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) {
859 ss_->Pump(); 827 ss_->Pump();
860 lr = 0; 828 lr = 0;
861 handled = true; 829 handled = true;
862 } 830 }
863 return handled; 831 return handled;
864 } 832 }
865 833
866 } // namespace rtc 834 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/win32socketserver.h ('k') | webrtc/base/winping.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698