diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-30 00:06:20 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-30 00:06:20 +0000 |
commit | e3280d6cedb73ee9fb2a8b4aa9f74d72c7456d83 (patch) | |
tree | 2c321bbf1d408d6a3aca193836be84ab89d4ecb4 /jingle | |
parent | dbae6b00f7636167508c4d56e16418b7f717bc54 (diff) | |
download | chromium_src-e3280d6cedb73ee9fb2a8b4aa9f74d72c7456d83.zip chromium_src-e3280d6cedb73ee9fb2a8b4aa9f74d72c7456d83.tar.gz chromium_src-e3280d6cedb73ee9fb2a8b4aa9f74d72c7456d83.tar.bz2 |
PseudoTcp to expose settings of nagling and ACK delay
Changes are as follows:
1. PseudoTcp to expose whether Nagle's algo is turned on.
2. PseudoTcp to expose setting of ACK delay.
3. JingleSession to disable Nagle's algo.
4. Set ACK delay to 10 milliseconds.
5. Unit tests for testing jingle session latency.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7275024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91057 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/glue/pseudotcp_adapter.cc | 22 | ||||
-rw-r--r-- | jingle/glue/pseudotcp_adapter.h | 6 |
2 files changed, 28 insertions, 0 deletions
diff --git a/jingle/glue/pseudotcp_adapter.cc b/jingle/glue/pseudotcp_adapter.cc index b86c805..91e4462 100644 --- a/jingle/glue/pseudotcp_adapter.cc +++ b/jingle/glue/pseudotcp_adapter.cc @@ -46,6 +46,10 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify, // This is triggered by NotifyClock, NotifyPacket, Recv and Send. virtual WriteResult TcpWritePacket(cricket::PseudoTcp* tcp, const char* buffer, size_t len) OVERRIDE; + + void SetAckDelay(int delay_ms); + void SetNoDelay(bool no_delay); + private: // These are invoked by the underlying Socket, and may trigger callbacks. // They hold a reference to |this| while running, to protect from deletion. @@ -269,6 +273,14 @@ void PseudoTcpAdapter::Core::OnTcpClosed(PseudoTcp* tcp, uint32 error) { } } +void PseudoTcpAdapter::Core::SetAckDelay(int delay_ms) { + pseudo_tcp_.SetOption(cricket::PseudoTcp::OPT_ACKDELAY, delay_ms); +} + +void PseudoTcpAdapter::Core::SetNoDelay(bool no_delay) { + pseudo_tcp_.SetOption(cricket::PseudoTcp::OPT_NODELAY, no_delay ? 1 : 0); +} + cricket::IPseudoTcpNotify::WriteResult PseudoTcpAdapter::Core::TcpWritePacket( PseudoTcp* tcp, const char* buffer, @@ -473,4 +485,14 @@ base::TimeDelta PseudoTcpAdapter::GetConnectTimeMicros() const { return base::TimeDelta::FromMicroseconds(-1); } +void PseudoTcpAdapter::SetAckDelay(int delay_ms) { + DCHECK(CalledOnValidThread()); + core_->SetAckDelay(delay_ms); +} + +void PseudoTcpAdapter::SetNoDelay(bool no_delay) { + DCHECK(CalledOnValidThread()); + core_->SetNoDelay(no_delay); +} + } // namespace jingle_glue diff --git a/jingle/glue/pseudotcp_adapter.h b/jingle/glue/pseudotcp_adapter.h index e53d722..643af3f 100644 --- a/jingle/glue/pseudotcp_adapter.h +++ b/jingle/glue/pseudotcp_adapter.h @@ -52,6 +52,12 @@ class PseudoTcpAdapter : public net::StreamSocket, base::NonThreadSafe { virtual int64 NumBytesRead() const OVERRIDE; virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; + // Set the delay for sending ACK. + void SetAckDelay(int delay_ms); + + // Set whether Nagle's algorithm is enabled. + void SetNoDelay(bool nagling); + private: class Core; |