diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 1d067653..9677a6c8 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -132,6 +132,7 @@ HttpDownstreamConnection::HttpDownstreamConnection(DownstreamAddrGroup *group, get_config()->tls.dyn_rec.idle_timeout, PROTO_HTTP1), do_read_(&HttpDownstreamConnection::noop), do_write_(&HttpDownstreamConnection::noop), + do_signal_write_(&HttpDownstreamConnection::noop), worker_(worker), ssl_ctx_(group->shared_addr->tls ? worker->get_cl_ssl_ctx() : nullptr), group_(group), @@ -1080,6 +1081,8 @@ int HttpDownstreamConnection::connected() { ev_set_cb(&conn_.wev, writecb); + do_signal_write_ = &HttpDownstreamConnection::actual_signal_write; + if (conn_.tls.ssl) { do_read_ = &HttpDownstreamConnection::tls_handshake; do_write_ = &HttpDownstreamConnection::tls_handshake; @@ -1099,8 +1102,11 @@ int HttpDownstreamConnection::on_write() { return do_write_(*this); } void HttpDownstreamConnection::on_upstream_change(Upstream *upstream) {} -void HttpDownstreamConnection::signal_write() { +void HttpDownstreamConnection::signal_write() { do_signal_write_(*this); } + +int HttpDownstreamConnection::actual_signal_write() { ev_feed_event(conn_.loop, &conn_.wev, EV_WRITE); + return 0; } int HttpDownstreamConnection::noop() { return 0; } diff --git a/src/shrpx_http_downstream_connection.h b/src/shrpx_http_downstream_connection.h index 32c41702..0199d9cc 100644 --- a/src/shrpx_http_downstream_connection.h +++ b/src/shrpx_http_downstream_connection.h @@ -75,12 +75,14 @@ public: int connected(); void signal_write(); + int actual_signal_write(); int noop(); private: Connection conn_; - std::function do_read_, do_write_; + std::function do_read_, do_write_, + do_signal_write_; Worker *worker_; // nullptr if TLS is not used. SSL_CTX *ssl_ctx_;