summaryrefslogtreecommitdiffhomepage
path: root/go/port.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--go/port.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/go/port.go b/go/port.go
index 72d33d31..59a13f8b 100644
--- a/go/port.go
+++ b/go/port.go
@@ -50,7 +50,11 @@ func add_port(p *port) {
port_registry_.m = make(map[port_key]*port)
}
- port_registry_.m[p.key] = p
+ old := port_registry_.m[p.key]
+
+ if old == nil {
+ port_registry_.m[p.key] = p
+ }
port_registry_.Unlock()
}