MEDIUM: connections: Change struct wait_list to wait_event.
When subscribing, we don't need to provide a list element, only the h2 mux
needs it. So instead, Add a list element to struct h2s, and use it when a
list is needed.
This forces us to use the unsubscribe method, since we can't just unsubscribe
by using LIST_DEL anymore.
This patch is larger than it should be because it includes some renaming.
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 759b5f0..a0487ef 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -632,7 +632,7 @@
int did_send = 0;
/* We're already waiting to be able to send, give up */
- if (si->wait_list.wait_reason & SUB_CAN_SEND)
+ if (si->wait_event.wait_reason & SUB_CAN_SEND)
return 0;
if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR)
@@ -641,7 +641,7 @@
if (conn->flags & CO_FL_HANDSHAKE) {
/* a handshake was requested */
/* Schedule ourself to be woken up once the handshake is done */
- conn->xprt->subscribe(conn, SUB_CAN_SEND, &si->wait_list);
+ conn->xprt->subscribe(conn, SUB_CAN_SEND, &si->wait_event);
return 0;
}
@@ -722,7 +722,7 @@
/* We couldn't send all of our data, let the mux know we'd like to send more */
if (co_data(oc)) {
cs_want_send(cs);
- conn->mux->subscribe(cs, SUB_CAN_SEND, &si->wait_list);
+ conn->mux->subscribe(cs, SUB_CAN_SEND, &si->wait_event);
}
return did_send;
}
@@ -736,9 +736,9 @@
if (!cs)
return NULL;
redo:
- if (!(si->wait_list.wait_reason & SUB_CAN_SEND))
+ if (!(si->wait_event.wait_reason & SUB_CAN_SEND))
ret = si_cs_send(cs);
- if (!(si->wait_list.wait_reason & SUB_CAN_RECV))
+ if (!(si->wait_event.wait_reason & SUB_CAN_RECV))
ret |= si_cs_recv(cs);
if (ret != 0)
si_cs_process(cs);
@@ -1137,7 +1137,7 @@
/* If another call to si_cs_recv() failed, and we subscribed to
* recv events already, give up now.
*/
- if (si->wait_list.wait_reason & SUB_CAN_RECV)
+ if (si->wait_event.wait_reason & SUB_CAN_RECV)
return 0;
/* maybe we were called immediately after an asynchronous shutr */
@@ -1347,7 +1347,7 @@
goto out_shutdown_r;
/* Subscribe to receive events */
- conn->mux->subscribe(cs, SUB_CAN_RECV, &si->wait_list);
+ conn->mux->subscribe(cs, SUB_CAN_RECV, &si->wait_event);
return cur_read != 0;