ReadEvent blocks forever on closed connection
nyxar opened this issue · 0 comments
nyxar commented
Easily reproducible:
eslConn.Close()
eslConn.Send("connect")
ev, err := eslConn.ReadEvent()
No errors are emitted to the ReadEvent in this case, since it just listens on channels with no timeout or check against the connection state, and the err is read off h.err by the call to Send, I believe.
I propose adding a simple ReadWithTimeout, ReadWithDeadline, or ReadWithContext function to alleviate the issue, allowing us to back out of that select. Else, the connection error state needs to be persistent when ReadEvent is used.