close all UDP connections when the reuse is closed
@@ -193,5 +193,15 @@ func (r *reuse) Listen(network string, laddr *net.UDPAddr) (*reuseConn, error) {
func (r *reuse) Close() error {
close(r.closeChan)
<-r.gcStopChan
+ r.mutex.Lock()
+ for _, conn := range r.global {
+ conn.Close()
+ }
+ for _, conns := range r.unicast {
+ for _, conn := range conns {
+ conn.Close()
+ }
+ }
+ r.mutex.Unlock()
return nil
}
