OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int Send(const std::string& message) { | 95 int Send(const std::string& message) { |
96 LOG(LS_INFO) << "Client sending '" << message << "'"; | 96 LOG(LS_INFO) << "Client sending '" << message << "'"; |
97 | 97 |
98 return ssl_adapter_->Send(message.data(), message.length()); | 98 return ssl_adapter_->Send(message.data(), message.length()); |
99 } | 99 } |
100 | 100 |
101 void OnSSLAdapterReadEvent(rtc::AsyncSocket* socket) { | 101 void OnSSLAdapterReadEvent(rtc::AsyncSocket* socket) { |
102 char buffer[4096] = ""; | 102 char buffer[4096] = ""; |
103 | 103 |
104 // Read data received from the server and store it in our internal buffer. | 104 // Read data received from the server and store it in our internal buffer. |
105 int read = socket->Recv(buffer, sizeof(buffer) - 1); | 105 int read = socket->Recv(buffer, sizeof(buffer) - 1, nullptr); |
106 if (read != -1) { | 106 if (read != -1) { |
107 buffer[read] = '\0'; | 107 buffer[read] = '\0'; |
108 | 108 |
109 LOG(LS_INFO) << "Client received '" << buffer << "'"; | 109 LOG(LS_INFO) << "Client received '" << buffer << "'"; |
110 | 110 |
111 data_ += buffer; | 111 data_ += buffer; |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 void OnSSLAdapterCloseEvent(rtc::AsyncSocket* socket, int error) { | 115 void OnSSLAdapterCloseEvent(rtc::AsyncSocket* socket, int error) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 TestTransfer("Hello, world!"); | 414 TestTransfer("Hello, world!"); |
415 } | 415 } |
416 | 416 |
417 // Test transfer between client and server, using ECDSA | 417 // Test transfer between client and server, using ECDSA |
418 TEST_F(SSLAdapterTestDTLS_ECDSA, TestDTLSTransfer) { | 418 TEST_F(SSLAdapterTestDTLS_ECDSA, TestDTLSTransfer) { |
419 TestHandshake(true); | 419 TestHandshake(true); |
420 TestTransfer("Hello, world!"); | 420 TestTransfer("Hello, world!"); |
421 } | 421 } |
422 | 422 |
423 #endif // SSL_USE_OPENSSL | 423 #endif // SSL_USE_OPENSSL |
OLD | NEW |