summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-04 20:01:42 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-04 20:01:42 +0000
commitb8acc61f423293b4dacba4f2ef42af0c5d0b0a28 (patch)
treefe738833745bfa04f43063b01a47c1c35b442dcc
parent9b4dd10af7b7ba6c25dfa10e7c2d71385899d41c (diff)
downloadchromium_src-b8acc61f423293b4dacba4f2ef42af0c5d0b0a28.zip
chromium_src-b8acc61f423293b4dacba4f2ef42af0c5d0b0a28.tar.gz
chromium_src-b8acc61f423293b4dacba4f2ef42af0c5d0b0a28.tar.bz2
Set send buffer size for the raw socket used by chromoting
On Windows the send buffer size of UDP socket has a much smaller value than the PseudoTcp's send buffer size. This causes PseudoTcp to flood the UDP socket and results in a EWOULDBLOCK, however the code doesn't handle this properly but simply treat the packet as lost. This happens very often and causes Windows host to be very janky. BUG=91495 TEST=None Review URL: http://codereview.chromium.org/7508015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95473 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--jingle/glue/channel_socket_adapter.cc6
-rw-r--r--remoting/protocol/jingle_stream_connector.cc10
2 files changed, 12 insertions, 4 deletions
diff --git a/jingle/glue/channel_socket_adapter.cc b/jingle/glue/channel_socket_adapter.cc
index f0671b0..ca13af1 100644
--- a/jingle/glue/channel_socket_adapter.cc
+++ b/jingle/glue/channel_socket_adapter.cc
@@ -90,14 +90,12 @@ int TransportChannelSocketAdapter::Write(
bool TransportChannelSocketAdapter::SetReceiveBufferSize(int32 size) {
DCHECK_EQ(MessageLoop::current(), message_loop_);
- NOTIMPLEMENTED();
- return false;
+ return channel_->SetOption(talk_base::Socket::OPT_RCVBUF, size) == 0;
}
bool TransportChannelSocketAdapter::SetSendBufferSize(int32 size) {
DCHECK_EQ(MessageLoop::current(), message_loop_);
- NOTIMPLEMENTED();
- return false;
+ return channel_->SetOption(talk_base::Socket::OPT_SNDBUF, size) == 0;
}
void TransportChannelSocketAdapter::Close(int error_code) {
diff --git a/remoting/protocol/jingle_stream_connector.cc b/remoting/protocol/jingle_stream_connector.cc
index 01ba8f8..6ee07fb 100644
--- a/remoting/protocol/jingle_stream_connector.cc
+++ b/remoting/protocol/jingle_stream_connector.cc
@@ -98,6 +98,16 @@ void JingleStreamConnector::Connect(bool initiator,
}
bool JingleStreamConnector::EstablishTCPConnection(net::Socket* socket) {
+ // Set options for the raw socket layer.
+ // Send buffer size is set to match the PseudoTcp layer so that it can fit
+ // all the data submitted by the PseudoTcp layer.
+ socket->SetSendBufferSize(kTcpSendBufferSize);
+ // TODO(hclam): We should also set the receive buffer size once we can detect
+ // the underlying socket is a TCP socket. We should also investigate what
+ // value would gurantee that Windows's UDP socket doesn't return a EWOULDBLOCK
+ // error.
+
+ // Set options for the TCP layer.
jingle_glue::PseudoTcpAdapter* adapter =
new jingle_glue::PseudoTcpAdapter(socket);
adapter->SetAckDelay(kTcpAckDelayMilliseconds);