anacrolix / utp

Use anacrolix/go-libutp instead
https://github.com/anacrolix/go-libutp
Mozilla Public License 2.0
173 stars 35 forks source link

listener sockets closed when accepted connections close #4

Closed whyrusleeping closed 8 years ago

whyrusleeping commented 8 years ago

If i create a socket for accepting new connections on, I want to keep that open even if all the connections that have been made to me get closed, That expectation is violated by this line: https://github.com/anacrolix/utp/blob/master/utp.go#L1252

I think that line only needs to be executed if the connections drop to zero AND the socket was created through a 'dial' (or even then probably not). Its probably the case that the right thing to do is to only close the actual socket when 'Close' is called.

jbenet commented 8 years ago

Yes, I think it should remain open until Close is called. Perhaps there could be a CloseAfterConns which will cause Close to happen after the last connection closes.

anacrolix commented 8 years ago

Sounds like an oversight on my part. Overzealous refactoring. I'll address it in a few hours.

anacrolix commented 8 years ago

Fixed by 5341f3c935837fd4351011fefd73f703d865380e