nxt_port_socket.c (203:7794b01dd5aa) nxt_port_socket.c (205:cb624bb9ac0c)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 157 unchanged lines hidden (view full) ---

166nxt_int_t
167nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port, nxt_uint_t type,
168 nxt_fd_t fd, uint32_t stream, nxt_port_id_t reply_port, nxt_buf_t *b)
169{
170 nxt_port_send_msg_t *msg;
171
172 nxt_queue_each(msg, &port->messages, nxt_port_send_msg_t, link) {
173
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 157 unchanged lines hidden (view full) ---

166nxt_int_t
167nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port, nxt_uint_t type,
168 nxt_fd_t fd, uint32_t stream, nxt_port_id_t reply_port, nxt_buf_t *b)
169{
170 nxt_port_send_msg_t *msg;
171
172 nxt_queue_each(msg, &port->messages, nxt_port_send_msg_t, link) {
173
174 if ((type & NXT_PORT_MSG_SYNC) != 0) {
175 msg->opened = 0;
176 continue;
177 }
178
174 if (msg->port_msg.stream == stream &&
179 if (msg->port_msg.stream == stream &&
175 msg->port_msg.reply_port == reply_port) {
180 msg->port_msg.reply_port == reply_port &&
181 msg->port_msg.last == 0 &&
182 msg->opened) {
176
183
177 nxt_assert(msg->port_msg.last == 0);
178
179 /*
180 * An fd is ignored since a file descriptor
181 * must be sent only in the first message of a stream.
182 */
183 nxt_buf_chain_add(&msg->buf, b);
184
185 msg->port_msg.last |= (type & NXT_PORT_MSG_LAST) != 0;
186

--- 9 unchanged lines hidden (view full) ---

196
197 msg->link.next = NULL;
198 msg->link.prev = NULL;
199
200 msg->buf = b;
201 msg->fd = fd;
202 msg->close_fd = (type & NXT_PORT_MSG_CLOSE_FD) != 0;
203 msg->share = 0;
184 /*
185 * An fd is ignored since a file descriptor
186 * must be sent only in the first message of a stream.
187 */
188 nxt_buf_chain_add(&msg->buf, b);
189
190 msg->port_msg.last |= (type & NXT_PORT_MSG_LAST) != 0;
191

--- 9 unchanged lines hidden (view full) ---

201
202 msg->link.next = NULL;
203 msg->link.prev = NULL;
204
205 msg->buf = b;
206 msg->fd = fd;
207 msg->close_fd = (type & NXT_PORT_MSG_CLOSE_FD) != 0;
208 msg->share = 0;
209 msg->opened = 1;
204
205 msg->work.next = NULL;
206 msg->work.handler = nxt_port_release_send_msg;
207 msg->work.task = task;
208 msg->work.obj = msg;
209 msg->work.data = task->thread->engine;
210
211 msg->engine = task->thread->engine;

--- 353 unchanged lines hidden ---
210
211 msg->work.next = NULL;
212 msg->work.handler = nxt_port_release_send_msg;
213 msg->work.task = task;
214 msg->work.obj = msg;
215 msg->work.data = task->thread->engine;
216
217 msg->engine = task->thread->engine;

--- 353 unchanged lines hidden ---