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

Side by Side Diff: webrtc/p2p/base/dtlstransportchannel.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ice_transport_->SendPacket(static_cast<const char*>(data), data_len, 88 ice_transport_->SendPacket(static_cast<const char*>(data), data_len,
89 packet_options); 89 packet_options);
90 if (written) { 90 if (written) {
91 *written = data_len; 91 *written = data_len;
92 } 92 }
93 return rtc::SR_SUCCESS; 93 return rtc::SR_SUCCESS;
94 } 94 }
95 95
96 bool StreamInterfaceChannel::OnPacketReceived(const char* data, size_t size) { 96 bool StreamInterfaceChannel::OnPacketReceived(const char* data, size_t size) {
97 // We force a read event here to ensure that we don't overflow our queue. 97 // We force a read event here to ensure that we don't overflow our queue.
98 bool ret = packets_.WriteBack(data, size, NULL); 98 bool ret = packets_.WriteBack(data, size, nullptr);
99 RTC_CHECK(ret) << "Failed to write packet to queue."; 99 RTC_CHECK(ret) << "Failed to write packet to queue.";
100 if (ret) { 100 if (ret) {
101 SignalEvent(this, rtc::SE_READ, 0); 101 SignalEvent(this, rtc::SE_READ, 0);
102 } 102 }
103 return ret; 103 return ret;
104 } 104 }
105 105
106 void StreamInterfaceChannel::Close() { 106 void StreamInterfaceChannel::Close() {
107 packets_.Clear(); 107 packets_.Clear();
108 state_ = rtc::SS_CLOSED; 108 state_ = rtc::SS_CLOSED;
109 } 109 }
110 110
111 DtlsTransport::DtlsTransport(IceTransportInternal* ice_transport) 111 DtlsTransport::DtlsTransport(IceTransportInternal* ice_transport)
112 : transport_name_(ice_transport->transport_name()), 112 : transport_name_(ice_transport->transport_name()),
113 component_(ice_transport->component()), 113 component_(ice_transport->component()),
114 network_thread_(rtc::Thread::Current()), 114 network_thread_(rtc::Thread::Current()),
115 ice_transport_(ice_transport), 115 ice_transport_(ice_transport),
116 downward_(NULL), 116 downward_(nullptr),
117 ssl_role_(rtc::SSL_CLIENT), 117 ssl_role_(rtc::SSL_CLIENT),
118 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12) { 118 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12) {
119 ice_transport_->SignalWritableState.connect(this, 119 ice_transport_->SignalWritableState.connect(this,
120 &DtlsTransport::OnWritableState); 120 &DtlsTransport::OnWritableState);
121 ice_transport_->SignalReadPacket.connect(this, &DtlsTransport::OnReadPacket); 121 ice_transport_->SignalReadPacket.connect(this, &DtlsTransport::OnReadPacket);
122 ice_transport_->SignalSentPacket.connect(this, &DtlsTransport::OnSentPacket); 122 ice_transport_->SignalSentPacket.connect(this, &DtlsTransport::OnSentPacket);
123 ice_transport_->SignalReadyToSend.connect(this, 123 ice_transport_->SignalReadyToSend.connect(this,
124 &DtlsTransport::OnReadyToSend); 124 &DtlsTransport::OnReadyToSend);
125 ice_transport_->SignalReceivingState.connect( 125 ice_transport_->SignalReceivingState.connect(
126 this, &DtlsTransport::OnReceivingState); 126 this, &DtlsTransport::OnReceivingState);
(...skipping 11 matching lines...) Expand all
138 } else { 138 } else {
139 LOG_J(LS_ERROR, this) << "Can't change DTLS local identity in this state"; 139 LOG_J(LS_ERROR, this) << "Can't change DTLS local identity in this state";
140 return false; 140 return false;
141 } 141 }
142 } 142 }
143 143
144 if (certificate) { 144 if (certificate) {
145 local_certificate_ = certificate; 145 local_certificate_ = certificate;
146 dtls_active_ = true; 146 dtls_active_ = true;
147 } else { 147 } else {
148 LOG_J(LS_INFO, this) << "NULL DTLS identity supplied. Not doing DTLS"; 148 LOG_J(LS_INFO, this) << "null DTLS identity supplied. Not doing DTLS";
149 } 149 }
150 150
151 return true; 151 return true;
152 } 152 }
153 153
154 rtc::scoped_refptr<rtc::RTCCertificate> DtlsTransport::GetLocalCertificate() 154 rtc::scoped_refptr<rtc::RTCCertificate> DtlsTransport::GetLocalCertificate()
155 const { 155 const {
156 return local_certificate_; 156 return local_certificate_;
157 } 157 }
158 158
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 const rtc::PacketOptions& options, 378 const rtc::PacketOptions& options,
379 int flags) { 379 int flags) {
380 if (!dtls_active_) { 380 if (!dtls_active_) {
381 // Not doing DTLS. 381 // Not doing DTLS.
382 return ice_transport_->SendPacket(data, size, options); 382 return ice_transport_->SendPacket(data, size, options);
383 } 383 }
384 384
385 switch (dtls_state()) { 385 switch (dtls_state()) {
386 case DTLS_TRANSPORT_NEW: 386 case DTLS_TRANSPORT_NEW:
387 // Can't send data until the connection is active. 387 // Can't send data until the connection is active.
388 // TODO(ekr@rtfm.com): assert here if dtls_ is NULL? 388 // TODO(ekr@rtfm.com): assert here if dtls_ is null?
389 return -1; 389 return -1;
390 case DTLS_TRANSPORT_CONNECTING: 390 case DTLS_TRANSPORT_CONNECTING:
391 // Can't send data until the connection is active. 391 // Can't send data until the connection is active.
392 return -1; 392 return -1;
393 case DTLS_TRANSPORT_CONNECTED: 393 case DTLS_TRANSPORT_CONNECTED:
394 if (flags & PF_SRTP_BYPASS) { 394 if (flags & PF_SRTP_BYPASS) {
395 RTC_DCHECK(!srtp_ciphers_.empty()); 395 RTC_DCHECK(!srtp_ciphers_.empty());
396 if (!IsRtpPacket(data, size)) { 396 if (!IsRtpPacket(data, size)) {
397 return -1; 397 return -1;
398 } 398 }
399 399
400 return ice_transport_->SendPacket(data, size, options); 400 return ice_transport_->SendPacket(data, size, options);
401 } else { 401 } else {
402 return (dtls_->WriteAll(data, size, NULL, NULL) == rtc::SR_SUCCESS) 402 return (dtls_->WriteAll(data, size, nullptr, nullptr) ==
403 rtc::SR_SUCCESS)
403 ? static_cast<int>(size) 404 ? static_cast<int>(size)
404 : -1; 405 : -1;
405 } 406 }
406 case DTLS_TRANSPORT_FAILED: 407 case DTLS_TRANSPORT_FAILED:
407 case DTLS_TRANSPORT_CLOSED: 408 case DTLS_TRANSPORT_CLOSED:
408 // Can't send anything when we're closed. 409 // Can't send anything when we're closed.
409 return -1; 410 return -1;
410 default: 411 default:
411 RTC_NOTREACHED(); 412 RTC_NOTREACHED();
412 return -1; 413 return -1;
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 716
716 dtls_->SetInitialRetransmissionTimeout(initial_timeout); 717 dtls_->SetInitialRetransmissionTimeout(initial_timeout);
717 } else { 718 } else {
718 LOG_J(LS_INFO, this) 719 LOG_J(LS_INFO, this)
719 << "no RTT estimate - using default DTLS handshake timeout"; 720 << "no RTT estimate - using default DTLS handshake timeout";
720 } 721 }
721 } 722 }
722 723
723 724
724 } // namespace cricket 725 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698