diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-08-02 13:10:48 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-08-02 13:10:48 +0300 |
commit | 3812ffd336414904affc43d29229b04a2d6d8ae6 (patch) | |
tree | f12fca86a5e4280bd75234776cac80c9b9902d0b /src/nginext | |
parent | a7ef8481fcda2f2dc5b0b84a93e66bce62c83918 (diff) | |
download | unit-3812ffd336414904affc43d29229b04a2d6d8ae6.tar.gz unit-3812ffd336414904affc43d29229b04a2d6d8ae6.tar.bz2 |
Added bit flags to type parameter of nxt_port_socket_write().
NXT_PORT_MSG_LAST - mark message as last;
NXT_PORT_MSG_CLOSE_FD - close fd right after send;
Type constants altered to include last flag for single buffer messages.
Last sign is critical for coming port RPC layer. Handlers unregistered on last
message. Create sync buffer is not convenient, extra parameter is better.
Diffstat (limited to 'src/nginext')
-rw-r--r-- | src/nginext/nxt_go_lib.c | 4 | ||||
-rw-r--r-- | src/nginext/nxt_go_port.c | 12 | ||||
-rw-r--r-- | src/nginext/nxt_go_port_memory.c | 4 | ||||
-rw-r--r-- | src/nginext/nxt_go_run_ctx.c | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/nginext/nxt_go_lib.c b/src/nginext/nxt_go_lib.c index 57c3da8e..87f583d7 100644 --- a/src/nginext/nxt_go_lib.c +++ b/src/nginext/nxt_go_lib.c @@ -189,8 +189,8 @@ nxt_go_ready() port_msg.stream = atol(go_stream); port_msg.pid = getpid(); port_msg.reply_port = 0; - port_msg.type = NXT_PORT_MSG_READY; - port_msg.last = 0; + port_msg.type = _NXT_PORT_MSG_READY; + port_msg.last = 1; port_msg.mmap = 0; nxt_go_master_send(&port_msg, sizeof(port_msg), NULL, 0); diff --git a/src/nginext/nxt_go_port.c b/src/nginext/nxt_go_port.c index 58ba90ea..af50b860 100644 --- a/src/nginext/nxt_go_port.c +++ b/src/nginext/nxt_go_port.c @@ -152,13 +152,13 @@ nxt_go_port_on_read(void *buf, size_t buf_size, void *oob, size_t oob_size) } switch (port_msg->type) { - case NXT_PORT_MSG_QUIT: + case _NXT_PORT_MSG_QUIT: nxt_go_debug("quit"); nxt_go_set_quit(); break; - case NXT_PORT_MSG_NEW_PORT: + case _NXT_PORT_MSG_NEW_PORT: nxt_go_debug("new port"); new_port_msg = payload; @@ -166,22 +166,22 @@ nxt_go_port_on_read(void *buf, size_t buf_size, void *oob, size_t oob_size) -1, fd); break; - case NXT_PORT_MSG_CHANGE_FILE: + case _NXT_PORT_MSG_CHANGE_FILE: nxt_go_debug("change file"); break; - case NXT_PORT_MSG_MMAP: + case _NXT_PORT_MSG_MMAP: nxt_go_debug("mmap"); nxt_go_new_incoming_mmap(port_msg->pid, fd); break; - case NXT_PORT_MSG_DATA: + case _NXT_PORT_MSG_DATA: nxt_go_debug("data"); return nxt_go_data_handler(port_msg, buf_size); - case NXT_PORT_MSG_REMOVE_PID: + case _NXT_PORT_MSG_REMOVE_PID: nxt_go_debug("remove pid"); /* TODO remove all ports for this pid in Go */ diff --git a/src/nginext/nxt_go_port_memory.c b/src/nginext/nxt_go_port_memory.c index 7e3f7a1a..dbdf5f73 100644 --- a/src/nginext/nxt_go_port_memory.c +++ b/src/nginext/nxt_go_port_memory.c @@ -112,8 +112,8 @@ nxt_go_new_port_mmap(nxt_go_process_t *process, nxt_port_id_t id) port_msg.stream = 0; port_msg.pid = getpid(); port_msg.reply_port = 0; - port_msg.type = NXT_PORT_MSG_MMAP; - port_msg.last = 0; + port_msg.type = _NXT_PORT_MSG_MMAP; + port_msg.last = 1; port_msg.mmap = 0; cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int)); diff --git a/src/nginext/nxt_go_run_ctx.c b/src/nginext/nxt_go_run_ctx.c index 0788b0d1..c6481b95 100644 --- a/src/nginext/nxt_go_run_ctx.c +++ b/src/nginext/nxt_go_run_ctx.c @@ -165,7 +165,7 @@ nxt_go_ctx_init(nxt_go_run_ctx_t *ctx, nxt_port_msg_t *port_msg, ctx->wport_msg.stream = port_msg->stream; ctx->wport_msg.pid = getpid(); - ctx->wport_msg.type = NXT_PORT_MSG_DATA; + ctx->wport_msg.type = _NXT_PORT_MSG_DATA; ctx->wport_msg.mmap = 1; ctx->wmmap_msg = (nxt_port_mmap_msg_t *) ( &ctx->wport_msg + 1 ); |