mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
Turn off Nagle algorithm to decrease latency.
This is safe because of the way writes are performed: for each transmission, all outgoing messages are concatenated in memory and only a single write() syscall is made.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <WinSock2.h>
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -136,6 +137,11 @@ llvm::StringRef TCPStream::getPeerIP() const { return m_peerIP; }
|
||||
|
||||
int TCPStream::getPeerPort() const { return m_peerPort; }
|
||||
|
||||
void TCPStream::setNoDelay() {
|
||||
int optval = 1;
|
||||
setsockopt(m_sd, IPPROTO_TCP, TCP_NODELAY, (char*)&optval, sizeof optval);
|
||||
}
|
||||
|
||||
bool TCPStream::WaitForReadEvent(int timeout) {
|
||||
fd_set sdset;
|
||||
struct timeval tv;
|
||||
|
||||
Reference in New Issue
Block a user