summaryrefslogtreecommitdiffhomepage
path: root/go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--go/port.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/go/port.go b/go/port.go
index a68cae74..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()
}
@@ -138,6 +142,8 @@ func nxt_go_port_send(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
if err != nil {
nxt_go_warn("write result %d (%d), %s", n, oobn, err)
+
+ n = -1
}
return C.ssize_t(n)
@@ -164,6 +170,8 @@ func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
if err != nil {
nxt_go_warn("read result %d (%d), %s", n, oobn, err)
+
+ n = -1
}
return C.ssize_t(n)