Skip to content

Commit

Permalink
tcp: unset POLLOUT if nothing queued
Browse files Browse the repository at this point in the history
When removing a tx to send, unset POLLOUT from the connection's poll()
events if the tx_queue is empty.

Reported by Chuck Cranor <chuck@ece.cmu.edu>
  • Loading branch information
scottatchley committed Feb 17, 2017
1 parent 3ab663e commit 87984af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/plugins/ctp/tcp/ctp_tcp_api.c
Expand Up @@ -1990,6 +1990,9 @@ tcp_progress_conn_sends(cci__conn_t *conn)
}
}
}
/* If nothing queued, unset POLLOUT */
if (TAILQ_EMPTY(&tconn->queued))
tconn->pfd->events &= ~POLLOUT;
pthread_mutex_unlock(&tconn->lock);

if (put_tx) {
Expand Down Expand Up @@ -3644,6 +3647,9 @@ tcp_poll_events(cci__ep_t *ep)
!TAILQ_EMPTY(&tconn->queued)) {
evt = TAILQ_FIRST(&tconn->queued);
TAILQ_REMOVE(&tconn->queued, evt, entry);
/* If nothing queued, unset POLLOUT */
if (TAILQ_EMPTY(&tconn->queued))
tconn->pfd->events &= ~POLLOUT;
} else {
evt = TAILQ_FIRST(&tconn->pending);
TAILQ_REMOVE(&tconn->pending, evt, entry);
Expand Down

0 comments on commit 87984af

Please sign in to comment.