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

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

Issue 1429513004: Switch usage of _DEBUG macro to NDEBUG. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: REBASE Created 5 years, 1 month 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/opensslstreamadapter.cc ('k') | webrtc/base/sigslot.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
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 return address; 165 return address;
166 } 166 }
167 167
168 int Bind(const SocketAddress& bind_addr) override { 168 int Bind(const SocketAddress& bind_addr) override {
169 sockaddr_storage addr_storage; 169 sockaddr_storage addr_storage;
170 size_t len = bind_addr.ToSockAddrStorage(&addr_storage); 170 size_t len = bind_addr.ToSockAddrStorage(&addr_storage);
171 sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage); 171 sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage);
172 int err = ::bind(s_, addr, static_cast<int>(len)); 172 int err = ::bind(s_, addr, static_cast<int>(len));
173 UpdateLastError(); 173 UpdateLastError();
174 #ifdef _DEBUG 174 #if !defined(NDEBUG)
175 if (0 == err) { 175 if (0 == err) {
176 dbg_addr_ = "Bound @ "; 176 dbg_addr_ = "Bound @ ";
177 dbg_addr_.append(GetLocalAddress().ToString()); 177 dbg_addr_.append(GetLocalAddress().ToString());
178 } 178 }
179 #endif // _DEBUG 179 #endif
180 return err; 180 return err;
181 } 181 }
182 182
183 int Connect(const SocketAddress& addr) override { 183 int Connect(const SocketAddress& addr) override {
184 // TODO: Implicit creation is required to reconnect... 184 // TODO: Implicit creation is required to reconnect...
185 // ...but should we make it more explicit? 185 // ...but should we make it more explicit?
186 if (state_ != CS_CLOSED) { 186 if (state_ != CS_CLOSED) {
187 SetError(EALREADY); 187 SetError(EALREADY);
188 return SOCKET_ERROR; 188 return SOCKET_ERROR;
189 } 189 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 354 }
355 return received; 355 return received;
356 } 356 }
357 357
358 int Listen(int backlog) override { 358 int Listen(int backlog) override {
359 int err = ::listen(s_, backlog); 359 int err = ::listen(s_, backlog);
360 UpdateLastError(); 360 UpdateLastError();
361 if (err == 0) { 361 if (err == 0) {
362 state_ = CS_CONNECTING; 362 state_ = CS_CONNECTING;
363 enabled_events_ |= DE_ACCEPT; 363 enabled_events_ |= DE_ACCEPT;
364 #ifdef _DEBUG 364 #if !defined(NDEBUG)
365 dbg_addr_ = "Listening @ "; 365 dbg_addr_ = "Listening @ ";
366 dbg_addr_.append(GetLocalAddress().ToString()); 366 dbg_addr_.append(GetLocalAddress().ToString());
367 #endif // _DEBUG 367 #endif
368 } 368 }
369 return err; 369 return err;
370 } 370 }
371 371
372 AsyncSocket* Accept(SocketAddress* out_addr) override { 372 AsyncSocket* Accept(SocketAddress* out_addr) override {
373 sockaddr_storage addr_storage; 373 sockaddr_storage addr_storage;
374 socklen_t addr_len = sizeof(addr_storage); 374 socklen_t addr_len = sizeof(addr_storage);
375 sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage); 375 sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage);
376 SOCKET s = ::accept(s_, addr, &addr_len); 376 SOCKET s = ::accept(s_, addr, &addr_len);
377 UpdateLastError(); 377 UpdateLastError();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 PhysicalSocketServer* ss_; 542 PhysicalSocketServer* ss_;
543 SOCKET s_; 543 SOCKET s_;
544 uint8_t enabled_events_; 544 uint8_t enabled_events_;
545 bool udp_; 545 bool udp_;
546 int error_; 546 int error_;
547 // Protects |error_| that is accessed from different threads. 547 // Protects |error_| that is accessed from different threads.
548 mutable CriticalSection crit_; 548 mutable CriticalSection crit_;
549 ConnState state_; 549 ConnState state_;
550 AsyncResolver* resolver_; 550 AsyncResolver* resolver_;
551 551
552 #ifdef _DEBUG 552 #if !defined(NDEBUG)
553 std::string dbg_addr_; 553 std::string dbg_addr_;
554 #endif // _DEBUG; 554 #endif
555 }; 555 };
556 556
557 #if defined(WEBRTC_POSIX) 557 #if defined(WEBRTC_POSIX)
558 class EventDispatcher : public Dispatcher { 558 class EventDispatcher : public Dispatcher {
559 public: 559 public:
560 EventDispatcher(PhysicalSocketServer* ss) : ss_(ss), fSignaled_(false) { 560 EventDispatcher(PhysicalSocketServer* ss) : ss_(ss), fSignaled_(false) {
561 if (pipe(afd_) < 0) 561 if (pipe(afd_) < 0)
562 LOG(LERROR) << "pipe failed"; 562 LOG(LERROR) << "pipe failed";
563 ss_->Add(this); 563 ss_->Add(this);
564 } 564 }
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 } 1081 }
1082 1082
1083 virtual void OnEvent(uint32_t ff, int err) { 1083 virtual void OnEvent(uint32_t ff, int err) {
1084 int cache_id = id_; 1084 int cache_id = id_;
1085 // Make sure we deliver connect/accept first. Otherwise, consumers may see 1085 // Make sure we deliver connect/accept first. Otherwise, consumers may see
1086 // something like a READ followed by a CONNECT, which would be odd. 1086 // something like a READ followed by a CONNECT, which would be odd.
1087 if (((ff & DE_CONNECT) != 0) && (id_ == cache_id)) { 1087 if (((ff & DE_CONNECT) != 0) && (id_ == cache_id)) {
1088 if (ff != DE_CONNECT) 1088 if (ff != DE_CONNECT)
1089 LOG(LS_VERBOSE) << "Signalled with DE_CONNECT: " << ff; 1089 LOG(LS_VERBOSE) << "Signalled with DE_CONNECT: " << ff;
1090 enabled_events_ &= ~DE_CONNECT; 1090 enabled_events_ &= ~DE_CONNECT;
1091 #ifdef _DEBUG 1091 #if !defined(NDEBUG)
1092 dbg_addr_ = "Connected @ "; 1092 dbg_addr_ = "Connected @ ";
1093 dbg_addr_.append(GetRemoteAddress().ToString()); 1093 dbg_addr_.append(GetRemoteAddress().ToString());
1094 #endif // _DEBUG 1094 #endif
1095 SignalConnectEvent(this); 1095 SignalConnectEvent(this);
1096 } 1096 }
1097 if (((ff & DE_ACCEPT) != 0) && (id_ == cache_id)) { 1097 if (((ff & DE_ACCEPT) != 0) && (id_ == cache_id)) {
1098 enabled_events_ &= ~DE_ACCEPT; 1098 enabled_events_ &= ~DE_ACCEPT;
1099 SignalReadEvent(this); 1099 SignalReadEvent(this);
1100 } 1100 }
1101 if ((ff & DE_READ) != 0) { 1101 if ((ff & DE_READ) != 0) {
1102 enabled_events_ &= ~DE_READ; 1102 enabled_events_ &= ~DE_READ;
1103 SignalReadEvent(this); 1103 SignalReadEvent(this);
1104 } 1104 }
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 break; 1627 break;
1628 } 1628 }
1629 } 1629 }
1630 1630
1631 // Done 1631 // Done
1632 return true; 1632 return true;
1633 } 1633 }
1634 #endif // WEBRTC_WIN 1634 #endif // WEBRTC_WIN
1635 1635
1636 } // namespace rtc 1636 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/opensslstreamadapter.cc ('k') | webrtc/base/sigslot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698