nghttpx: Fix downstream connect callback called early
This commit is contained in:
parent
b27107385e
commit
5487b64fa6
|
@ -132,6 +132,7 @@ HttpDownstreamConnection::HttpDownstreamConnection(DownstreamAddrGroup *group,
|
||||||
get_config()->tls.dyn_rec.idle_timeout, PROTO_HTTP1),
|
get_config()->tls.dyn_rec.idle_timeout, PROTO_HTTP1),
|
||||||
do_read_(&HttpDownstreamConnection::noop),
|
do_read_(&HttpDownstreamConnection::noop),
|
||||||
do_write_(&HttpDownstreamConnection::noop),
|
do_write_(&HttpDownstreamConnection::noop),
|
||||||
|
do_signal_write_(&HttpDownstreamConnection::noop),
|
||||||
worker_(worker),
|
worker_(worker),
|
||||||
ssl_ctx_(group->shared_addr->tls ? worker->get_cl_ssl_ctx() : nullptr),
|
ssl_ctx_(group->shared_addr->tls ? worker->get_cl_ssl_ctx() : nullptr),
|
||||||
group_(group),
|
group_(group),
|
||||||
|
@ -1080,6 +1081,8 @@ int HttpDownstreamConnection::connected() {
|
||||||
|
|
||||||
ev_set_cb(&conn_.wev, writecb);
|
ev_set_cb(&conn_.wev, writecb);
|
||||||
|
|
||||||
|
do_signal_write_ = &HttpDownstreamConnection::actual_signal_write;
|
||||||
|
|
||||||
if (conn_.tls.ssl) {
|
if (conn_.tls.ssl) {
|
||||||
do_read_ = &HttpDownstreamConnection::tls_handshake;
|
do_read_ = &HttpDownstreamConnection::tls_handshake;
|
||||||
do_write_ = &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::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);
|
ev_feed_event(conn_.loop, &conn_.wev, EV_WRITE);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HttpDownstreamConnection::noop() { return 0; }
|
int HttpDownstreamConnection::noop() { return 0; }
|
||||||
|
|
|
@ -75,12 +75,14 @@ public:
|
||||||
|
|
||||||
int connected();
|
int connected();
|
||||||
void signal_write();
|
void signal_write();
|
||||||
|
int actual_signal_write();
|
||||||
|
|
||||||
int noop();
|
int noop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection conn_;
|
Connection conn_;
|
||||||
std::function<int(HttpDownstreamConnection &)> do_read_, do_write_;
|
std::function<int(HttpDownstreamConnection &)> do_read_, do_write_,
|
||||||
|
do_signal_write_;
|
||||||
Worker *worker_;
|
Worker *worker_;
|
||||||
// nullptr if TLS is not used.
|
// nullptr if TLS is not used.
|
||||||
SSL_CTX *ssl_ctx_;
|
SSL_CTX *ssl_ctx_;
|
||||||
|
|
Loading…
Reference in New Issue