summaryrefslogtreecommitdiffhomepage
path: root/go/nxt_cgo_lib.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-08-11 19:20:15 +0300
committerMax Romanov <max.romanov@nginx.com>2020-08-11 19:20:15 +0300
commit83595606121a821f9e3cef0f0b7e7fe87eb1e50a (patch)
tree2374867dd2f69654a71e95b7abec3fdad13ffd1a /go/nxt_cgo_lib.c
parent6e31d6cd39be9d3f4ee680fc13c3fe42f5cd39e7 (diff)
downloadunit-83595606121a821f9e3cef0f0b7e7fe87eb1e50a.tar.gz
unit-83595606121a821f9e3cef0f0b7e7fe87eb1e50a.tar.bz2
Introducing the shared application port.
This is the port shared between all application processes which use it to pass requests for processing. Using it significantly simplifies the request processing code in the router. The drawback is 2 more file descriptors per each configured application and more complex libunit message wait/read code.
Diffstat (limited to '')
-rw-r--r--go/nxt_cgo_lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/go/nxt_cgo_lib.c b/go/nxt_cgo_lib.c
index 937996b0..f7171f55 100644
--- a/go/nxt_cgo_lib.c
+++ b/go/nxt_cgo_lib.c
@@ -44,7 +44,7 @@ nxt_cgo_run(uintptr_t handler)
return NXT_UNIT_ERROR;
}
- rc = nxt_unit_run(ctx);
+ rc = nxt_unit_run_ctx(ctx);
nxt_unit_done(ctx);
@@ -105,7 +105,7 @@ nxt_cgo_str_init(nxt_cgo_str_t *dst, nxt_unit_sptr_t *sptr, uint32_t length)
static int
nxt_cgo_add_port(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port)
{
- nxt_go_add_port(port->id.pid, port->id.id,
+ nxt_go_add_port((uintptr_t) ctx, port->id.pid, port->id.id,
port->in_fd, port->out_fd);
port->in_fd = -1;
@@ -204,6 +204,13 @@ nxt_cgo_request_done(uintptr_t req, int res)
void
+nxt_cgo_unit_run_shared(uintptr_t ctx)
+{
+ nxt_unit_run_shared((nxt_unit_ctx_t *) ctx);
+}
+
+
+void
nxt_cgo_warn(uintptr_t msg, uint32_t msg_len)
{
nxt_unit_warn(NULL, "%.*s", (int) msg_len, (char *) msg);