Skip to content

Commit

Permalink
snocket: SO_LINGER option
Browse files Browse the repository at this point in the history
Set SO_LINGER option with 0 linger interval.
  • Loading branch information
coot committed Oct 26, 2021
1 parent d6b3b0b commit fd2065a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ouroboros-network-framework/src/Ouroboros/Network/Snocket.hs
Expand Up @@ -62,6 +62,7 @@ import Network.Mux.Trace (MuxTrace)
import qualified Network.Mux.Bearer.Socket as Mx

import Ouroboros.Network.IOManager
import Ouroboros.Network.Linger (StructLinger (..))


-- | Named pipes and Berkeley sockets have different API when accepting
Expand Down Expand Up @@ -300,6 +301,9 @@ socketSnocket ioManager = Snocket {
Socket.setSocketOption sd Socket.ReusePort 1
#endif
Socket.setSocketOption sd Socket.NoDelay 1
Socket.setSockOpt sd Socket.Linger
(StructLinger { sl_onoff = 1,
sl_linger = 0 })
when (fml == Socket.AF_INET6)
-- An AF_INET6 socket can be used to talk to both IPv4 and IPv6 end points, and
-- it is enabled by default on some systems. Disabled here since we run a separate
Expand Down

0 comments on commit fd2065a

Please sign in to comment.