diff options
Diffstat (limited to 'go/port.go')
-rw-r--r-- | go/port.go | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -110,17 +110,21 @@ func nxt_go_add_port(ctx *C.nxt_unit_ctx_t, p *C.nxt_unit_port_t) C.int { p.in_fd = -1 p.out_fd = -1 - if new_port.key.id == 65535 { - go func(ctx *C.nxt_unit_ctx_t) { - C.nxt_unit_run_shared(ctx); - }(ctx) - } + return C.NXT_UNIT_OK +} + +//export nxt_go_ready +func nxt_go_ready(ctx *C.nxt_unit_ctx_t) C.int { + go func(ctx *C.nxt_unit_ctx_t) { + C.nxt_unit_run_shared(ctx) + }(ctx) return C.NXT_UNIT_OK } //export nxt_go_remove_port -func nxt_go_remove_port(unit *C.nxt_unit_t, p *C.nxt_unit_port_t) { +func nxt_go_remove_port(unit *C.nxt_unit_t, ctx *C.nxt_unit_ctx_t, + p *C.nxt_unit_port_t) { key := port_key{ pid: int(p.id.pid), @@ -165,7 +169,7 @@ func nxt_go_port_send(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int, //export nxt_go_port_recv func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int, - oob unsafe.Pointer, oob_size C.int) C.ssize_t { + oob unsafe.Pointer, oob_size *C.size_t) C.ssize_t { key := port_key{ pid: int(pid), @@ -180,7 +184,7 @@ func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int, } n, oobn, _, _, err := p.rcv.ReadMsgUnix(GoBytes(buf, buf_size), - GoBytes(oob, oob_size)) + GoBytes(oob, C.int(*oob_size))) if err != nil { if nerr, ok := err.(*net.OpError); ok { @@ -192,6 +196,9 @@ func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int, nxt_go_warn("read result %d (%d), %s", n, oobn, err) n = -1 + + } else { + *oob_size = C.size_t(oobn) } return C.ssize_t(n) |