diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-01-13 09:00:37 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-01-13 09:00:37 +0100 |
commit | 1dd590b91b893a413666b6daaed848d89bab7f05 (patch) | |
tree | 702ff9185afe072565a17fb089cf6014f4cbccfc /src/conn.go | |
parent | d73f960aab86b9a12b0b7d18aa80ce1d4f130695 (diff) |
Work on timer teardown + bug fixes
Added waitgroups to peer struct for routine
start / stop synchronisation
Diffstat (limited to 'src/conn.go')
-rw-r--r-- | src/conn.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/conn.go b/src/conn.go index ddb7ed1..1d033ff 100644 --- a/src/conn.go +++ b/src/conn.go @@ -64,13 +64,9 @@ func unsafeCloseBind(device *Device) error { return err } -func updateBind(device *Device) error { - device.mutex.Lock() - defer device.mutex.Unlock() - - netc := &device.net - netc.mutex.Lock() - defer netc.mutex.Unlock() +/* Must hold device and net lock + */ +func unsafeUpdateBind(device *Device) error { // close existing sockets @@ -89,6 +85,7 @@ func updateBind(device *Device) error { // bind to new port var err error + netc := &device.net netc.bind, netc.port, err = CreateBind(netc.port) if err != nil { netc.bind = nil |