CLEANUP: connection: rename subscription events values and event field
The SUB_CAN_SEND/SUB_CAN_RECV enum values have been confusing a few
times, especially when checking them on reading. After some discussion,
it appears that calling them SUB_RETRY_SEND/SUB_RETRY_RECV more
accurately reflects their purpose since these events may only appear
after a first attempt to perform the I/O operation has failed or was
not completed.
In addition the wait_reason field in struct wait_event which carries
them makes one think that a single reason may happen at once while
it is in fact a set of events. Since the struct is called wait_event
it makes sense that this field is called "events" to indicate it's the
list of events we're subscribed to.
Last, the values for SUB_RETRY_RECV/SEND were swapped so that value
1 corresponds to recv and 2 to send, as is done almost everywhere else
in the code an in the shutdown() call.
diff --git a/include/proto/connection.h b/include/proto/connection.h
index 6be311c..05148bb 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -650,11 +650,11 @@
static inline void conn_force_unsubscribe(struct connection *conn)
{
if (conn->recv_wait) {
- conn->recv_wait->wait_reason &= ~SUB_CAN_RECV;
+ conn->recv_wait->events &= ~SUB_RETRY_RECV;
conn->recv_wait = NULL;
}
if (conn->send_wait) {
- conn->send_wait->wait_reason &= ~SUB_CAN_SEND;
+ conn->send_wait->events &= ~SUB_RETRY_SEND;
conn->send_wait = NULL;
}
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index 2874664..2a896af 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -130,7 +130,7 @@
return -1;
si->wait_event.task->process = si_cs_io_cb;
si->wait_event.task->context = si;
- si->wait_event.wait_reason = 0;
+ si->wait_event.events = 0;
return 0;
}
@@ -169,8 +169,8 @@
return;
if ((cs = objt_cs(si->end))) {
- if (si->wait_event.wait_reason != 0)
- cs->conn->mux->unsubscribe(cs, si->wait_event.wait_reason,
+ if (si->wait_event.events != 0)
+ cs->conn->mux->unsubscribe(cs, si->wait_event.events,
&si->wait_event);
cs_destroy(cs);
}
@@ -461,7 +461,7 @@
if (!cs)
return 0; // only conn_streams are supported
- if (si->wait_event.wait_reason & SUB_CAN_RECV)
+ if (si->wait_event.events & SUB_RETRY_RECV)
return 0; // already subscribed
if (!si_rx_endp_ready(si) || si_rx_blocked(si))