gossip icon indicating copy to clipboard operation
gossip copied to clipboard

transport.Manager.Stop() returns before closing all sockets

Open StefanKopieczek opened this issue 9 years ago • 2 comments

... they close shortly afterwards, but there's a race window where Stop() has returned but the sockets are still bound.

This means that the sockets can't be reused immediately – subsequent binds might fail with a "socket in use" if they happen too soon after the previous manager is stopped.

In particular this causes occasional failures in the transport tests.

StefanKopieczek avatar Aug 04 '15 19:08 StefanKopieczek

Workaround for the transport tests in 23a7dedfd562c76a7c91626ca2e716502ca00968 Please remove when this issue is fixed.

StefanKopieczek avatar Aug 04 '15 19:08 StefanKopieczek

This is an easy enough fix, but I'll wait for issue13 to get merged, since there's no point editing the connTable when that commit completely changes the model.

Fix will be to add a 'stopped' bool channel to the connTable and connWatchers, to allow the caller to block until the callee has stopped.

StefanKopieczek avatar Aug 05 '15 16:08 StefanKopieczek