From 417321072f0a266528b82e05528039cccf34ad2c Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 3 Jan 2017 16:43:49 +0900 Subject: [PATCH] nghttpx: Fix assertion error in libev ev_io_start --- src/shrpx_rate_limit.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shrpx_rate_limit.cc b/src/shrpx_rate_limit.cc index 182e10a6..65b0f66c 100644 --- a/src/shrpx_rate_limit.cc +++ b/src/shrpx_rate_limit.cc @@ -83,13 +83,16 @@ void RateLimit::regen() { avail_ += rate_; } - if (avail_ > 0 && startw_req_) { + if (w_->fd >= 0 && avail_ > 0 && startw_req_) { ev_io_start(loop_, w_); handle_tls_pending_read(); } } void RateLimit::startw() { + if (w_->fd < 0) { + return; + } startw_req_ = true; if (rate_ == 0 || avail_ > 0) { ev_io_start(loop_, w_);