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

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

Issue 2625003003: Replace ASSERT(false) by RTC_NOTREACHED(). (Closed)
Patch Set: Created 3 years, 11 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/signalthread.cc ('k') | webrtc/base/socketpool.cc » ('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 #if defined(_MSC_VER) && _MSC_VER < 1300 11 #if defined(_MSC_VER) && _MSC_VER < 1300
12 #pragma warning(disable:4786) 12 #pragma warning(disable:4786)
13 #endif 13 #endif
14 14
15 #include <time.h> 15 #include <time.h>
16 #include <errno.h> 16 #include <errno.h>
17 17
18 #if defined(WEBRTC_WIN) 18 #if defined(WEBRTC_WIN)
19 #define WIN32_LEAN_AND_MEAN 19 #define WIN32_LEAN_AND_MEAN
20 #include <windows.h> 20 #include <windows.h>
21 #include <winsock2.h> 21 #include <winsock2.h>
22 #include <ws2tcpip.h> 22 #include <ws2tcpip.h>
23 #define SECURITY_WIN32 23 #define SECURITY_WIN32
24 #include <security.h> 24 #include <security.h>
25 #endif 25 #endif
26 26
27 #include <algorithm> 27 #include <algorithm>
28 28
29 #include "webrtc/base/bytebuffer.h" 29 #include "webrtc/base/bytebuffer.h"
30 #include "webrtc/base/checks.h"
30 #include "webrtc/base/common.h" 31 #include "webrtc/base/common.h"
31 #include "webrtc/base/httpcommon.h" 32 #include "webrtc/base/httpcommon.h"
32 #include "webrtc/base/logging.h" 33 #include "webrtc/base/logging.h"
33 #include "webrtc/base/socketadapters.h" 34 #include "webrtc/base/socketadapters.h"
34 #include "webrtc/base/stringencode.h" 35 #include "webrtc/base/stringencode.h"
35 #include "webrtc/base/stringutils.h" 36 #include "webrtc/base/stringutils.h"
36 37
37 namespace rtc { 38 namespace rtc {
38 39
39 BufferedReadAdapter::BufferedReadAdapter(AsyncSocket* socket, size_t size) 40 BufferedReadAdapter::BufferedReadAdapter(AsyncSocket* socket, size_t size)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void BufferedReadAdapter::OnReadEvent(AsyncSocket * socket) { 99 void BufferedReadAdapter::OnReadEvent(AsyncSocket * socket) {
99 ASSERT(socket == socket_); 100 ASSERT(socket == socket_);
100 101
101 if (!buffering_) { 102 if (!buffering_) {
102 AsyncSocketAdapter::OnReadEvent(socket); 103 AsyncSocketAdapter::OnReadEvent(socket);
103 return; 104 return;
104 } 105 }
105 106
106 if (data_len_ >= buffer_size_) { 107 if (data_len_ >= buffer_size_) {
107 LOG(INFO) << "Input buffer overflow"; 108 LOG(INFO) << "Input buffer overflow";
108 ASSERT(false); 109 RTC_NOTREACHED();
109 data_len_ = 0; 110 data_len_ = 0;
110 } 111 }
111 112
112 int len = 113 int len =
113 socket_->Recv(buffer_ + data_len_, buffer_size_ - data_len_, nullptr); 114 socket_->Recv(buffer_ + data_len_, buffer_size_ - data_len_, nullptr);
114 if (len < 0) { 115 if (len < 0) {
115 // TODO: Do something better like forwarding the error to the user. 116 // TODO: Do something better like forwarding the error to the user.
116 LOG_ERR(INFO) << "Recv"; 117 LOG_ERR(INFO) << "Recv";
117 return; 118 return;
118 } 119 }
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 void LoggingSocketAdapter::OnCloseEvent(AsyncSocket * socket, int err) { 904 void LoggingSocketAdapter::OnCloseEvent(AsyncSocket * socket, int err) {
904 LogMultiline(level_, label_.c_str(), false, NULL, 0, hex_mode_, &lms_); 905 LogMultiline(level_, label_.c_str(), false, NULL, 0, hex_mode_, &lms_);
905 LogMultiline(level_, label_.c_str(), true, NULL, 0, hex_mode_, &lms_); 906 LogMultiline(level_, label_.c_str(), true, NULL, 0, hex_mode_, &lms_);
906 LOG_V(level_) << label_ << " Closed with error: " << err; 907 LOG_V(level_) << label_ << " Closed with error: " << err;
907 AsyncSocketAdapter::OnCloseEvent(socket, err); 908 AsyncSocketAdapter::OnCloseEvent(socket, err);
908 } 909 }
909 910
910 /////////////////////////////////////////////////////////////////////////////// 911 ///////////////////////////////////////////////////////////////////////////////
911 912
912 } // namespace rtc 913 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/signalthread.cc ('k') | webrtc/base/socketpool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698