Sync flag introduced for port type.
To avoid transfer mmap_msg before new mmap message.
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
NXT_PORT_MSG_LAST = 0x100,
|
NXT_PORT_MSG_LAST = 0x100,
|
||||||
NXT_PORT_MSG_CLOSE_FD = 0x200,
|
NXT_PORT_MSG_CLOSE_FD = 0x200,
|
||||||
|
NXT_PORT_MSG_SYNC = 0x400,
|
||||||
|
|
||||||
NXT_PORT_MSG_MASK = 0xFF,
|
NXT_PORT_MSG_MASK = 0xFF,
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ typedef enum {
|
|||||||
NXT_PORT_MSG_NEW_PORT = _NXT_PORT_MSG_NEW_PORT | NXT_PORT_MSG_LAST,
|
NXT_PORT_MSG_NEW_PORT = _NXT_PORT_MSG_NEW_PORT | NXT_PORT_MSG_LAST,
|
||||||
NXT_PORT_MSG_CHANGE_FILE = _NXT_PORT_MSG_CHANGE_FILE | NXT_PORT_MSG_LAST,
|
NXT_PORT_MSG_CHANGE_FILE = _NXT_PORT_MSG_CHANGE_FILE | NXT_PORT_MSG_LAST,
|
||||||
NXT_PORT_MSG_MMAP = _NXT_PORT_MSG_MMAP | NXT_PORT_MSG_LAST |
|
NXT_PORT_MSG_MMAP = _NXT_PORT_MSG_MMAP | NXT_PORT_MSG_LAST |
|
||||||
NXT_PORT_MSG_CLOSE_FD,
|
NXT_PORT_MSG_CLOSE_FD | NXT_PORT_MSG_SYNC,
|
||||||
NXT_PORT_MSG_DATA = _NXT_PORT_MSG_DATA,
|
NXT_PORT_MSG_DATA = _NXT_PORT_MSG_DATA,
|
||||||
NXT_PORT_MSG_DATA_LAST = _NXT_PORT_MSG_DATA | NXT_PORT_MSG_LAST,
|
NXT_PORT_MSG_DATA_LAST = _NXT_PORT_MSG_DATA | NXT_PORT_MSG_LAST,
|
||||||
NXT_PORT_MSG_REMOVE_PID = _NXT_PORT_MSG_REMOVE_PID | NXT_PORT_MSG_LAST,
|
NXT_PORT_MSG_REMOVE_PID = _NXT_PORT_MSG_REMOVE_PID | NXT_PORT_MSG_LAST,
|
||||||
@@ -66,6 +67,7 @@ typedef struct {
|
|||||||
size_t share;
|
size_t share;
|
||||||
nxt_fd_t fd;
|
nxt_fd_t fd;
|
||||||
nxt_bool_t close_fd;
|
nxt_bool_t close_fd;
|
||||||
|
nxt_bool_t opened;
|
||||||
nxt_port_msg_t port_msg;
|
nxt_port_msg_t port_msg;
|
||||||
|
|
||||||
nxt_work_t work;
|
nxt_work_t work;
|
||||||
|
|||||||
@@ -171,10 +171,15 @@ nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port, nxt_uint_t type,
|
|||||||
|
|
||||||
nxt_queue_each(msg, &port->messages, nxt_port_send_msg_t, link) {
|
nxt_queue_each(msg, &port->messages, nxt_port_send_msg_t, link) {
|
||||||
|
|
||||||
if (msg->port_msg.stream == stream &&
|
if ((type & NXT_PORT_MSG_SYNC) != 0) {
|
||||||
msg->port_msg.reply_port == reply_port) {
|
msg->opened = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
nxt_assert(msg->port_msg.last == 0);
|
if (msg->port_msg.stream == stream &&
|
||||||
|
msg->port_msg.reply_port == reply_port &&
|
||||||
|
msg->port_msg.last == 0 &&
|
||||||
|
msg->opened) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An fd is ignored since a file descriptor
|
* An fd is ignored since a file descriptor
|
||||||
@@ -201,6 +206,7 @@ nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port, nxt_uint_t type,
|
|||||||
msg->fd = fd;
|
msg->fd = fd;
|
||||||
msg->close_fd = (type & NXT_PORT_MSG_CLOSE_FD) != 0;
|
msg->close_fd = (type & NXT_PORT_MSG_CLOSE_FD) != 0;
|
||||||
msg->share = 0;
|
msg->share = 0;
|
||||||
|
msg->opened = 1;
|
||||||
|
|
||||||
msg->work.next = NULL;
|
msg->work.next = NULL;
|
||||||
msg->work.handler = nxt_port_release_send_msg;
|
msg->work.handler = nxt_port_release_send_msg;
|
||||||
|
|||||||
Reference in New Issue
Block a user