This change adds the method CloseNow() to utp.Socket. This method attempts to block until Go has completely destroyed the underlying socket. Go has a mutex around the file descriptor under the hood so we must wait until the PacketConn has returned from all reads and writes.
This method should help to avoid "bind: address already in use" errors that can occur from lazily destroying the socket with Close() followed by recreating it on the same address as mentioned in #15.
@anacrolix
This change adds the method
CloseNow()
toutp.Socket
. This method attempts to block until Go has completely destroyed the underlying socket. Go has a mutex around the file descriptor under the hood so we must wait until the PacketConn has returned from all reads and writes.This method should help to avoid "bind: address already in use" errors that can occur from lazily destroying the socket with
Close()
followed by recreating it on the same address as mentioned in #15.