summaryrefslogtreecommitdiffhomepage
path: root/conn.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-16 22:20:15 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-16 22:20:15 +0200
commit846d721dfd0cde953f2e9304d6ef50110de050eb (patch)
tree8de15914ab39d0aad1b50d03530b82fece54c740 /conn.go
parent23eca94508d7cef0c1adbbc37c81050899ca1d60 (diff)
Finer-grained start-stop synchronization
Diffstat (limited to 'conn.go')
-rw-r--r--conn.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/conn.go b/conn.go
index 92f4cfe..d3919ca 100644
--- a/conn.go
+++ b/conn.go
@@ -12,6 +12,10 @@ import (
"net"
)
+const (
+ ConnRoutineNumber = 2
+)
+
/* A Bind handles listening on a port for both IPv6 and IPv4 UDP traffic
*/
type Bind interface {
@@ -153,6 +157,8 @@ func (device *Device) BindUpdate() error {
// start receiving routines
+ device.state.starting.Add(ConnRoutineNumber)
+ device.state.stopping.Add(ConnRoutineNumber)
go device.RoutineReceiveIncoming(ipv4.Version, netc.bind)
go device.RoutineReceiveIncoming(ipv6.Version, netc.bind)