[PATCH 04/11] Port: removed useless msg->cancelled == 0 checks.
Andrew Clayton
andrew at digital-domain.net
Thu Jun 16 01:00:54 UTC 2022
In src/nxt_port_socket.c::nxt_port_read_msg_process() msg->cancelled is
set to 0 and is not touched again.
However there are several checks for it being == 0 which are _always_
true, so remove them.
I'm assuming that this is functioning as intended and that setting
msg->cancelled to 0 is correct.
msg->cancelled was set to 0 unconditionally in commit e227fc9
("Introducing application and port shared memory queues."), so I guess
the now redundant checks were simply missed for removal.
---
src/nxt_port_socket.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/nxt_port_socket.c b/src/nxt_port_socket.c
index 5752d5a..2649e69 100644
--- a/src/nxt_port_socket.c
+++ b/src/nxt_port_socket.c
@@ -1237,7 +1237,7 @@ nxt_port_read_msg_process(nxt_task_t *task, nxt_port_t *port,
} else {
if (nxt_slow_path(msg->port_msg.mf != 0)) {
- if (msg->port_msg.mmap && msg->cancelled == 0) {
+ if (msg->port_msg.mmap) {
nxt_port_mmap_read(task, msg);
b = msg->buf;
}
@@ -1251,25 +1251,18 @@ nxt_port_read_msg_process(nxt_task_t *task, nxt_port_t *port,
fmsg->port_msg.nf = 0;
fmsg->port_msg.mf = 0;
- if (nxt_fast_path(msg->cancelled == 0)) {
- msg->buf = NULL;
- msg->fd[0] = -1;
- msg->fd[1] = -1;
- b = NULL;
+ msg->buf = NULL;
+ msg->fd[0] = -1;
+ msg->fd[1] = -1;
+ b = NULL;
- } else {
- nxt_port_close_fds(msg->fd);
- }
} else {
- if (nxt_fast_path(msg->cancelled == 0)) {
-
- if (msg->port_msg.mmap) {
- nxt_port_mmap_read(task, msg);
- b = msg->buf;
- }
-
- port->handler(task, msg);
+ if (msg->port_msg.mmap) {
+ nxt_port_mmap_read(task, msg);
+ b = msg->buf;
}
+
+ port->handler(task, msg);
}
}
--
2.36.1
More information about the unit
mailing list