{
struct connection *conn = fdtab[fd].owner;
unsigned int flags;
- int io_available = 0;
+ int need_wake = 0;
if (unlikely(!conn)) {
activity[tid].conn_dead++;
*/
if (!conn_fd_check(conn))
goto leave;
+ need_wake = 1;
}
if (fd_send_ready(fd) && fd_send_active(fd)) {
*/
flags = 0;
if (conn->subs && conn->subs->events & SUB_RETRY_SEND) {
+ need_wake = 0; // wake will be called after this I/O
tasklet_wakeup(conn->subs->tasklet);
conn->subs->events &= ~SUB_RETRY_SEND;
if (!conn->subs->events)
conn->subs = NULL;
- } else
- io_available = 1;
+ }
fd_stop_send(fd);
}
*/
flags = 0;
if (conn->subs && conn->subs->events & SUB_RETRY_RECV) {
+ need_wake = 0; // wake will be called after this I/O
tasklet_wakeup(conn->subs->tasklet);
conn->subs->events &= ~SUB_RETRY_RECV;
if (!conn->subs->events)
conn->subs = NULL;
- } else
- io_available = 1;
+ }
}
leave:
* Note that the wake callback is allowed to release the connection and
* the fd (and return < 0 in this case).
*/
- if ((io_available || ((conn->flags ^ flags) & CO_FL_NOTIFY_DONE) ||
+ if ((need_wake || ((conn->flags ^ flags) & CO_FL_NOTIFY_DONE) ||
((flags & CO_FL_WAIT_XPRT) && !(conn->flags & CO_FL_WAIT_XPRT))) &&
conn->mux && conn->mux->wake && conn->mux->wake(conn) < 0)
return;