nghttpx: Add SSL_read/write error logging

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-06 21:56:19 +09:00
parent f6097ce6d0
commit a6cf6c00ea
2 changed files with 33 additions and 19 deletions

View File

@ -250,6 +250,9 @@ int ClientHandler::read_tls() {
ev_timer_again(loop_, &wt_); ev_timer_again(loop_, &wt_);
goto fin; goto fin;
default: default:
if (LOG_ENABLED(INFO)) {
CLOG(INFO, this) << "SSL_read: SSL_get_error returned " << err;
}
return -1; return -1;
} }
} }
@ -298,6 +301,9 @@ int ClientHandler::write_tls() {
ev_timer_again(loop_, &wt_); ev_timer_again(loop_, &wt_);
return 0; return 0;
default: default:
if (LOG_ENABLED(INFO)) {
CLOG(INFO, this) << "SSL_write: SSL_get_error returned " << err;
}
return -1; return -1;
} }
} }

View File

@ -1668,7 +1668,10 @@ int Http2Session::read_tls() {
rb_.reset(); rb_.reset();
struct iovec iov[2]; struct iovec iov[2];
auto iovcnt = rb_.wiovec(iov); auto iovcnt = rb_.wiovec(iov);
if (iovcnt > 0) { if (iovcnt == 0) {
return 0;
}
auto rv = SSL_read(ssl_, iov[0].iov_base, iov[0].iov_len); auto rv = SSL_read(ssl_, iov[0].iov_base, iov[0].iov_len);
if (rv == 0) { if (rv == 0) {
@ -1685,13 +1688,15 @@ int Http2Session::read_tls() {
ev_timer_again(loop_, &wt_); ev_timer_again(loop_, &wt_);
return 0; return 0;
default: default:
if (LOG_ENABLED(INFO)) {
SSLOG(INFO, this) << "SSL_read: SSL_get_error returned " << err;
}
return -1; return -1;
} }
} }
rb_.write(rv); rb_.write(rv);
} }
}
} }
int Http2Session::write_tls() { int Http2Session::write_tls() {
@ -1721,6 +1726,9 @@ int Http2Session::write_tls() {
ev_timer_again(loop_, &wt_); ev_timer_again(loop_, &wt_);
return 0; return 0;
default: default:
if (LOG_ENABLED(INFO)) {
SSLOG(INFO, this) << "SSL_write: SSL_get_error returned " << err;
}
return -1; return -1;
} }
} }