+static void msg2sndr_flush(void)
+{
+ if (defer_forwarding_messages)
+ return;
+
+ while (msg2sndr.head && io_multiplexing_out) {
+ struct msg_list_item *m = msg2sndr.head;
+ int tag = (IVAL(m->buf, 0) >> 24) - MPLEX_BASE;
+ if (!(msg2sndr.head = m->next))
+ msg2sndr.tail = NULL;
+ defer_forwarding_messages = 1;
+ switch (tag) {
+ case MSG_INFO:
+ case MSG_ERROR:
+ rwrite((enum logcode)tag, m->buf + 4, m->len - 4);
+ break;
+ default:
+ stats.total_written += m->len;
+ writefd_unbuffered(sock_f_out, m->buf, m->len);
+ break;
+ }
+ defer_forwarding_messages = 0;
+ free(m);
+ }
+}