Commit fa3452ec authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Use Connection::again_rt() in LiveCheck

parent 7451f2f2
...@@ -66,6 +66,10 @@ void timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { ...@@ -66,6 +66,10 @@ void timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
auto conn = static_cast<Connection *>(w->data); auto conn = static_cast<Connection *>(w->data);
auto live_check = static_cast<LiveCheck *>(conn->data); auto live_check = static_cast<LiveCheck *>(conn->data);
if (w == &conn->rt && !conn->expired_rt()) {
return;
}
live_check->on_failure(); live_check->on_failure();
} }
} // namespace } // namespace
...@@ -283,6 +287,7 @@ int LiveCheck::connected() { ...@@ -283,6 +287,7 @@ int LiveCheck::connected() {
ev_timer_again(conn_.loop, &conn_.wt); ev_timer_again(conn_.loop, &conn_.wt);
conn_.rlimit.startw(); conn_.rlimit.startw();
conn_.again_rt();
if (conn_.tls.ssl) { if (conn_.tls.ssl) {
read_ = &LiveCheck::tls_handshake; read_ = &LiveCheck::tls_handshake;
...@@ -310,7 +315,7 @@ int LiveCheck::connected() { ...@@ -310,7 +315,7 @@ int LiveCheck::connected() {
} }
int LiveCheck::tls_handshake() { int LiveCheck::tls_handshake() {
ev_timer_again(conn_.loop, &conn_.rt); conn_.last_read = ev_now(conn_.loop);
ERR_clear_error(); ERR_clear_error();
...@@ -385,7 +390,7 @@ int LiveCheck::tls_handshake() { ...@@ -385,7 +390,7 @@ int LiveCheck::tls_handshake() {
} }
int LiveCheck::read_tls() { int LiveCheck::read_tls() {
ev_timer_again(conn_.loop, &conn_.rt); conn_.last_read = ev_now(conn_.loop);
std::array<uint8_t, 4_k> buf; std::array<uint8_t, 4_k> buf;
...@@ -409,6 +414,8 @@ int LiveCheck::read_tls() { ...@@ -409,6 +414,8 @@ int LiveCheck::read_tls() {
} }
int LiveCheck::write_tls() { int LiveCheck::write_tls() {
conn_.last_read = ev_now(conn_.loop);
ERR_clear_error(); ERR_clear_error();
struct iovec iov; struct iovec iov;
...@@ -453,7 +460,7 @@ int LiveCheck::write_tls() { ...@@ -453,7 +460,7 @@ int LiveCheck::write_tls() {
} }
int LiveCheck::read_clear() { int LiveCheck::read_clear() {
ev_timer_again(conn_.loop, &conn_.rt); conn_.last_read = ev_now(conn_.loop);
std::array<uint8_t, 4_k> buf; std::array<uint8_t, 4_k> buf;
...@@ -475,6 +482,8 @@ int LiveCheck::read_clear() { ...@@ -475,6 +482,8 @@ int LiveCheck::read_clear() {
} }
int LiveCheck::write_clear() { int LiveCheck::write_clear() {
conn_.last_read = ev_now(conn_.loop);
struct iovec iov; struct iovec iov;
for (;;) { for (;;) {
......
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