StefanKopieczek / gossip

SIP stack in Golang
GNU Lesser General Public License v2.1
336 stars 109 forks source link

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

Open StefanKopieczek opened 9 years ago

StefanKopieczek commented 9 years ago

... 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 commented 9 years ago

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

StefanKopieczek commented 9 years ago

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.