Closed hvr closed 9 years ago
Hey Herbert, what is the status on this? Do you think you know what the right fix is?
I'd say this this an API design question.
I don't see a way around changing the API to be able to use the sa
information returned by (s,sa) <- accept sock
instead of (redundantly) calling getPeerName
again on the s
which may have been closed by then already.
It's not released on hackage yet, so we can go ahead and change it. Do you want to have a stab at fixing it? Otherwise I'll add it to my queue :)
OK, I'm about to fix this, but I'll have to ask you to test it. I'm worried the call to getSocketName
is going to cause the same issue.
I'm using code like the following, which causes problems with
haproxy
s default keepalive check which consists in sending aPROXY
header and closing the connection right ahead:The problem is that by the time
getPeerName
is called, the connection is already closed, so the system calls fails.However, if I there was a function which allowed me to pass in the
sa
I already got from theaccept
, i.e.I can write the code like below and avoid calling
getPeerName
(and thus avoid the failure):