Commit 2f994632 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Fix bug that --listener-disable-timeout option is not used

parent 0402481b
......@@ -1032,6 +1032,7 @@ void fill_default_config() {
// Default accept() backlog
listenerconf.backlog = 512;
listenerconf.host_unix = false;
listenerconf.timeout.sleep = 30_s;
}
}
......
......@@ -87,7 +87,7 @@ void AcceptHandler::accept_connection() {
case ENFILE:
LOG(WARN) << "acceptor: running out file descriptor; disable acceptor "
"temporarily";
conn_hnr_->disable_acceptor_temporary(30.);
conn_hnr_->sleep_acceptor(get_config()->conn.listener.timeout.sleep);
break;
}
......
......@@ -385,7 +385,7 @@ void ConnectionHandler::disable_acceptor() {
}
}
void ConnectionHandler::disable_acceptor_temporary(ev_tstamp t) {
void ConnectionHandler::sleep_acceptor(ev_tstamp t) {
if (t == 0. || ev_is_active(&disable_acceptor_timer_)) {
return;
}
......
......@@ -98,7 +98,7 @@ public:
AcceptHandler *get_acceptor6() const;
void enable_acceptor();
void disable_acceptor();
void disable_acceptor_temporary(ev_tstamp t);
void sleep_acceptor(ev_tstamp t);
void accept_pending_connection();
void graceful_shutdown_worker();
void set_graceful_shutdown(bool f);
......
......@@ -171,10 +171,18 @@ constexpr unsigned long long operator"" _g(unsigned long long g) {
// User-defined literals for time, converted into double in seconds
// hours
constexpr double operator"" _h(unsigned long long h) { return h * 60 * 60; }
// minutes
constexpr double operator"" _min(unsigned long long min) { return min * 60; }
// seconds
constexpr double operator"" _s(unsigned long long s) { return s; }
// milliseconds
constexpr double operator"" _ms(unsigned long long ms) { return ms / 1000.; }
// Returns a copy of NULL-terminated string [first, last).
template <typename InputIt>
std::unique_ptr<char[]> strcopy(InputIt first, InputIt last) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment