flush_ports: flush POSIX message queues properly
On Linux, read() on a message queue descriptor returns the message queue statistics, not the actual message queue data. We need to use mq_receive() to drain the queues instead. Fixes a problem where a POSIX message queue socket unit with messages in the queue at shutdown time could result in a hang on reboot/shutdown.
This commit is contained in:
committed by
Yu Watanabe
parent
676fb42aae
commit
ffb6adb763
+6
-2
@@ -2188,8 +2188,12 @@ static void flush_ports(Socket *s) {
|
||||
if (p->fd < 0)
|
||||
continue;
|
||||
|
||||
(void) flush_accept(p->fd);
|
||||
(void) flush_fd(p->fd);
|
||||
if (p->type == SOCKET_MQUEUE)
|
||||
(void) flush_mqueue(p->fd);
|
||||
else {
|
||||
(void) flush_accept(p->fd);
|
||||
(void) flush_fd(p->fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user