network-transport-tcp icon indicating copy to clipboard operation
network-transport-tcp copied to clipboard

Third call to receive after endpoint close will can't be finished

Open qnikst opened this issue 9 years ago • 0 comments

receive function n-t-tcp is implemented in such a way that first call to receive after EndPoint closed will return a chunk that will be evaluated to UserError "EndPointClosed" and next one will never finish. Simple test:

   Right transport1 <- createTransport "127.0.0.1" "0" defaultTCPParameters
  Right ep1        <- newEndPoint transport1
  closeEndPoint ep1
  EndPointClosed <- receive ep1
  Right _ <- trySome $ receive ep1
  _ <- receive ep1

see https://github.com/haskell-distributed/network-transport-tcp/blob/master/src/Network/Transport/TCP.hs#L704-L717

I'm not sure if this a problem, because use should not call receive after we had EndPointClosed event, maybe only in multithreaded case

qnikst avatar Jul 18 '15 18:07 qnikst