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 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 int AsyncSSLSocket::Connect(const SocketAddress& addr) { | 178 int AsyncSSLSocket::Connect(const SocketAddress& addr) { |
179 // Begin buffering before we connect, so that there isn't a race condition | 179 // Begin buffering before we connect, so that there isn't a race condition |
180 // between potential senders and receiving the OnConnectEvent signal | 180 // between potential senders and receiving the OnConnectEvent signal |
181 BufferInput(true); | 181 BufferInput(true); |
182 return BufferedReadAdapter::Connect(addr); | 182 return BufferedReadAdapter::Connect(addr); |
183 } | 183 } |
184 | 184 |
185 void AsyncSSLSocket::OnConnectEvent(AsyncSocket * socket) { | 185 void AsyncSSLSocket::OnConnectEvent(AsyncSocket * socket) { |
186 RTC_DCHECK(socket == socket_); | 186 RTC_DCHECK(socket == socket_); |
187 // TODO: we could buffer output too... | 187 // TODO: we could buffer output too... |
188 VERIFY(sizeof(kSslClientHello) == | 188 int res = DirectSend(kSslClientHello, sizeof(kSslClientHello)); |
189 DirectSend(kSslClientHello, sizeof(kSslClientHello))); | 189 RTC_DCHECK(sizeof(kSslClientHello) == res); |
kwiberg-webrtc
2017/02/07 09:39:49
RTC_DCHECK_EQ
nisse-webrtc
2017/02/07 10:48:15
Done.
| |
190 } | 190 } |
191 | 191 |
192 void AsyncSSLSocket::ProcessInput(char* data, size_t* len) { | 192 void AsyncSSLSocket::ProcessInput(char* data, size_t* len) { |
193 if (*len < sizeof(kSslServerHello)) | 193 if (*len < sizeof(kSslServerHello)) |
194 return; | 194 return; |
195 | 195 |
196 if (memcmp(kSslServerHello, data, sizeof(kSslServerHello)) != 0) { | 196 if (memcmp(kSslServerHello, data, sizeof(kSslServerHello)) != 0) { |
197 Close(); | 197 Close(); |
198 SignalCloseEvent(this, 0); // TODO: error code? | 198 SignalCloseEvent(this, 0); // TODO: error code? |
199 return; | 199 return; |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
903 void LoggingSocketAdapter::OnCloseEvent(AsyncSocket * socket, int err) { | 903 void LoggingSocketAdapter::OnCloseEvent(AsyncSocket * socket, int err) { |
904 LogMultiline(level_, label_.c_str(), false, NULL, 0, hex_mode_, &lms_); | 904 LogMultiline(level_, label_.c_str(), false, NULL, 0, hex_mode_, &lms_); |
905 LogMultiline(level_, label_.c_str(), true, NULL, 0, hex_mode_, &lms_); | 905 LogMultiline(level_, label_.c_str(), true, NULL, 0, hex_mode_, &lms_); |
906 LOG_V(level_) << label_ << " Closed with error: " << err; | 906 LOG_V(level_) << label_ << " Closed with error: " << err; |
907 AsyncSocketAdapter::OnCloseEvent(socket, err); | 907 AsyncSocketAdapter::OnCloseEvent(socket, err); |
908 } | 908 } |
909 | 909 |
910 /////////////////////////////////////////////////////////////////////////////// | 910 /////////////////////////////////////////////////////////////////////////////// |
911 | 911 |
912 } // namespace rtc | 912 } // namespace rtc |
OLD | NEW |