am e16a448d: Merge "emulator opengles: improve TcpStream throughput"

* commit 'e16a448df04a66e36bc9e48cc1c322187f65ef46':
  emulator opengles: improve TcpStream throughput
This commit is contained in:
David Turner
2011-08-15 16:19:46 -07:00
committed by Android Git Automerger

View File

@@ -23,6 +23,9 @@
#ifndef _WIN32 #ifndef _WIN32
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/tcp.h>
#else
#include <ws2tcpip.h>
#endif #endif
TcpStream::TcpStream(size_t bufSize) : TcpStream::TcpStream(size_t bufSize) :
@@ -39,6 +42,15 @@ TcpStream::TcpStream(int sock, size_t bufSize) :
m_bufsize(bufSize), m_bufsize(bufSize),
m_buf(NULL) m_buf(NULL)
{ {
// disable Nagle algorithm to improve bandwidth of small
// packets which are quite common in our implementation.
#ifdef _WIN32
DWORD flag;
#else
int flag;
#endif
flag = 1;
setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (const char*)&flag, sizeof(flag) );
} }
TcpStream::~TcpStream() TcpStream::~TcpStream()