diff options
author | Andrei Belov <defan@nginx.com> | 2021-11-18 17:04:04 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2021-11-18 17:04:04 +0300 |
commit | b400ccd1aa8eeb6a5de1707e0bb8c3d417fe69b7 (patch) | |
tree | 60ff49ffc16ef7cb3aad1beb2d78f051a8794cdf /go/port.go | |
parent | fafd44166d9e835e91a4c5668048308ce99a62bd (diff) | |
parent | b77895d1c7d6cd4826ac7427c91baa95b998a912 (diff) | |
download | unit-b400ccd1aa8eeb6a5de1707e0bb8c3d417fe69b7.tar.gz unit-b400ccd1aa8eeb6a5de1707e0bb8c3d417fe69b7.tar.bz2 |
Merged with the default branch.1.26.0-1
Diffstat (limited to '')
-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) |