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

Unified Diff: remoting/protocol/connection_tester.cc

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/connection_tester.h ('k') | remoting/protocol/datagram_channel_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/connection_tester.cc
diff --git a/remoting/protocol/connection_tester.cc b/remoting/protocol/connection_tester.cc
index 7df32a4b80e2eb0d4fba41cfe88e91d60837ff7f..5a70f871c9fde1119d8d29cbbbf42889a03195bc 100644
--- a/remoting/protocol/connection_tester.cc
+++ b/remoting/protocol/connection_tester.cc
@@ -8,14 +8,15 @@
#include "base/message_loop/message_loop.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
-#include "net/socket/stream_socket.h"
+#include "remoting/protocol/p2p_datagram_socket.h"
+#include "remoting/protocol/p2p_stream_socket.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
namespace protocol {
-StreamConnectionTester::StreamConnectionTester(net::StreamSocket* client_socket,
- net::StreamSocket* host_socket,
+StreamConnectionTester::StreamConnectionTester(P2PStreamSocket* client_socket,
+ P2PStreamSocket* host_socket,
int message_size,
int message_count)
: message_loop_(base::MessageLoop::current()),
@@ -127,11 +128,12 @@ void StreamConnectionTester::HandleReadResult(int result) {
}
}
-DatagramConnectionTester::DatagramConnectionTester(net::Socket* client_socket,
- net::Socket* host_socket,
- int message_size,
- int message_count,
- int delay_ms)
+DatagramConnectionTester::DatagramConnectionTester(
+ P2PDatagramSocket* client_socket,
+ P2PDatagramSocket* host_socket,
+ int message_size,
+ int message_count,
+ int delay_ms)
: message_loop_(base::MessageLoop::current()),
host_socket_(host_socket),
client_socket_(client_socket),
@@ -186,9 +188,8 @@ void DatagramConnectionTester::DoWrite() {
// Put index of this packet in the beginning of the packet body.
memcpy(packet->data(), &packets_sent_, sizeof(packets_sent_));
- int result = client_socket_->Write(
- packet.get(),
- message_size_,
+ int result = client_socket_->Send(
+ packet.get(), message_size_,
base::Bind(&DatagramConnectionTester::OnWritten, base::Unretained(this)));
HandleWriteResult(result);
}
@@ -218,9 +219,8 @@ void DatagramConnectionTester::DoRead() {
int kReadSize = message_size_ * 2;
read_buffer_ = new net::IOBuffer(kReadSize);
- result = host_socket_->Read(
- read_buffer_.get(),
- kReadSize,
+ result = host_socket_->Recv(
+ read_buffer_.get(), kReadSize,
base::Bind(&DatagramConnectionTester::OnRead, base::Unretained(this)));
HandleReadResult(result);
};
« no previous file with comments | « remoting/protocol/connection_tester.h ('k') | remoting/protocol/datagram_channel_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698