git.iko.soy/distributed-process
on master help sign in
Remove potential race condition
b76094bEdsko de Vries
network-transport/src/Network/Transport/TCP.hs+1−1
@@ -864,11 +864,11 @@ handleConnectionRequest transport sock = handle tryCloseSocket $ do
864 , _remoteIncoming = IntSet.empty
864 , _remoteIncoming = IntSet.empty
865 , sendOn = sendMany sock
865 , sendOn = sendMany sock
866 }
866 }
867+ sendMany sock [encodeInt32 ConnectionRequestAccepted]
867 -- TODO: this putMVar might block if the remote endpoint sends a
868 -- TODO: this putMVar might block if the remote endpoint sends a
868 -- connection request for a local endpoint that it is already
869 -- connection request for a local endpoint that it is already
869 -- connected to
870 -- connected to
870 putMVar (remoteState theirEndPoint) (RemoteEndPointValid vst)
871 putMVar (remoteState theirEndPoint) (RemoteEndPointValid vst)
871− sendMany sock [encodeInt32 ConnectionRequestAccepted]
872 return (Just theirEndPoint)
872 return (Just theirEndPoint)
873 -- If we left the scope of the exception handler with a return value of
873 -- If we left the scope of the exception handler with a return value of
874 -- Nothing then the socket is already closed; otherwise, the socket has
874 -- Nothing then the socket is already closed; otherwise, the socket has