From 456f406c0456dfff74be6f9dd3cb06bd66e82917 Mon Sep 17 00:00:00 2001 From: Laurent Rene de Cotret Date: Tue, 9 Jul 2024 08:46:21 -0400 Subject: [PATCH] Set TCP_NODELAY by default (#66). This was documented erroneously to be set by default. --- ChangeLog | 4 ++++ network-transport-tcp.cabal | 2 +- src/Network/Transport/TCP.hs | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27e5a5b..640fa0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2024-07-09 Laurent P. René de Cotret 0.8.4 + +* Set TCP_NODELAY by default. The documentation erroneously reported it as the default. (#66) + 2023-03-26 David Simmons-Duffin 0.8.3 * Disable a flaky test diff --git a/network-transport-tcp.cabal b/network-transport-tcp.cabal index 584d8f2..b5d5224 100644 --- a/network-transport-tcp.cabal +++ b/network-transport-tcp.cabal @@ -1,5 +1,5 @@ Name: network-transport-tcp -Version: 0.8.3 +Version: 0.8.4 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3 diff --git a/src/Network/Transport/TCP.hs b/src/Network/Transport/TCP.hs index 3ee8b93..304964b 100644 --- a/src/Network/Transport/TCP.hs +++ b/src/Network/Transport/TCP.hs @@ -525,6 +525,7 @@ data TCPParameters = TCPParameters { -- Defaults to True. , tcpNoDelay :: Bool -- | Should we set TCP_KEEPALIVE on connection sockets? + -- Defaults to False. , tcpKeepAlive :: Bool -- | Value of TCP_USER_TIMEOUT in milliseconds , tcpUserTimeout :: Maybe Int @@ -536,6 +537,8 @@ data TCPParameters = TCPParameters { -- -- Connection requests to this transport will also timeout if they don't -- send the required data before this many microseconds. + -- + -- Defaults to Nothing (no timeout). , transportConnectTimeout :: Maybe Int -- | Create a QDisc for an EndPoint. , tcpNewQDisc :: forall t . IO (QDisc t) @@ -554,10 +557,12 @@ data TCPParameters = TCPParameters { -- This is useful when operating on untrusted networks, because the peer -- could otherwise deny service to some victim by claiming the victim's -- address. + -- Defaults to False. , tcpCheckPeerHost :: Bool -- | What to do if there's an exception when accepting a new TCP -- connection. Throwing an exception here will cause the server to -- terminate. + -- Defaults to `throwIO`. , tcpServerExceptionHandler :: SomeException -> IO () } @@ -678,7 +683,7 @@ defaultTCPParameters = TCPParameters { tcpBacklog = N.maxListenQueue , tcpReuseServerAddr = True , tcpReuseClientAddr = True - , tcpNoDelay = False + , tcpNoDelay = True , tcpKeepAlive = False , tcpUserTimeout = Nothing , tcpNewQDisc = simpleUnboundedQDisc