diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-09-26 15:24:18 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-09-26 15:24:18 +0200 |
commit | 32d8932d1b29effa42fe56822988d3888c496873 (patch) | |
tree | f80baac43133724a9e9eb91c3dd95c9b56c5ca41 /src | |
parent | 6fa65bded45957434db08e5d33fe82a04af73a59 (diff) |
Sleep to close fd
Diffstat (limited to 'src')
-rw-r--r-- | src/conn.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/conn.go b/src/conn.go index 41a5b85..2cf588d 100644 --- a/src/conn.go +++ b/src/conn.go @@ -3,6 +3,7 @@ package main import ( "errors" "net" + "time" ) func parseEndpoint(s string) (*net.UDPAddr, error) { @@ -36,6 +37,10 @@ func updateUDPConn(device *Device) error { if netc.conn != nil { netc.conn.Close() netc.conn = nil + + // We need for that fd to be closed in all other go routines, which + // means we have to wait. TODO: find less horrible way of doing this. + time.Sleep(time.Second / 2) } // open new connection |