nghttp: prevent ContinueTimer double-invocation

If a 100 Continue interim response was received after the continue
timeout was reached, dispatch_continue() would force a double submission
of DATA frames. This patch prevents dispatch_continue() from doing
anything if the timer callback has already been invoked. This makes
ContinueTimer a single-shot mechanism, as originally intended.
This commit is contained in:
Jacob Champion 2016-03-23 09:09:13 -07:00
parent 1bc5cf5ee4
commit 3b7b6a660e
2 changed files with 6 additions and 2 deletions

View File

@ -344,7 +344,10 @@ void ContinueTimer::stop() {
} }
void ContinueTimer::dispatch_continue() { void ContinueTimer::dispatch_continue() {
ev_feed_event(loop, &timer, 0); // Only dispatch the timeout callback if it hasn't already been called.
if (ev_is_active(&timer)) {
ev_feed_event(loop, &timer, 0);
}
} }
namespace { namespace {

View File

@ -119,7 +119,8 @@ struct ContinueTimer {
void start(); void start();
void stop(); void stop();
// Schedules an immediate run of the continue callback on the loop // Schedules an immediate run of the continue callback on the loop, if the
// callback has not already been run
void dispatch_continue(); void dispatch_continue();
struct ev_loop *loop; struct ev_loop *loop;