We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 29f4e61 commit 107486aCopy full SHA for 107486a
Network/Socket/Shutdown.hs
@@ -11,7 +11,7 @@ module Network.Socket.Shutdown (
11
import qualified Control.Exception as E
12
import Foreign.Marshal.Alloc (mallocBytes, free)
13
14
-import Control.Concurrent (threadDelay)
+import Control.Concurrent (threadDelay, yield)
15
16
import Network.Socket.Buffer
17
import Network.Socket.Imports
@@ -55,6 +55,9 @@ gracefulClose s tmout0 = sendRecvFIN `E.finally` close s
55
case ex of
56
Left (E.SomeException _) -> return ()
57
Right () -> do
58
+ -- Giving CPU time to other threads hoping that
59
+ -- FIN arrives meanwhile.
60
+ yield
61
-- Waiting TCP FIN.
62
E.bracket (mallocBytes bufSize) free recvEOFloop
63
recvEOFloop buf = loop 1 0
0 commit comments