Merge branch 'nghttpx-dont-write-after-failure'
This commit is contained in:
commit
93b4866f5b
|
@ -2026,7 +2026,7 @@ int Http2Session::write_clear() {
|
|||
// contain part of response body. So keep reading. Invoke
|
||||
// read event to get read(2) error just in case.
|
||||
ev_feed_event(conn_.loop, &conn_.rev, EV_READ);
|
||||
wb_.drain(wb_.rleft());
|
||||
write_ = &Http2Session::write_void;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2141,7 +2141,7 @@ int Http2Session::write_tls() {
|
|||
// contain part of response body. So keep reading. Invoke
|
||||
// read event to get read(2) error just in case.
|
||||
ev_feed_event(conn_.loop, &conn_.rev, EV_READ);
|
||||
wb_.drain(wb_.rleft());
|
||||
write_ = &Http2Session::write_void;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2165,6 +2165,11 @@ int Http2Session::write_tls() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Http2Session::write_void() {
|
||||
conn_.wlimit.stopw();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Http2Session::should_hard_fail() const {
|
||||
switch (state_) {
|
||||
case PROXY_CONNECTING:
|
||||
|
|
|
@ -114,6 +114,9 @@ public:
|
|||
int tls_handshake();
|
||||
int read_tls();
|
||||
int write_tls();
|
||||
// This is a special write function which just stop write event
|
||||
// watcher.
|
||||
int write_void();
|
||||
|
||||
int downstream_read_proxy(const uint8_t *data, size_t datalen);
|
||||
int downstream_connect_proxy();
|
||||
|
|
|
@ -200,7 +200,8 @@ HttpDownstreamConnection::HttpDownstreamConnection(
|
|||
ioctrl_(&conn_.rlimit),
|
||||
response_htp_{0},
|
||||
initial_addr_idx_(initial_addr_idx),
|
||||
reuse_first_write_done_(true) {}
|
||||
reuse_first_write_done_(true),
|
||||
reusable_(true) {}
|
||||
|
||||
HttpDownstreamConnection::~HttpDownstreamConnection() {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
|
@ -1157,7 +1158,8 @@ int HttpDownstreamConnection::write_clear() {
|
|||
// part of response body. So keep reading. Invoke read event
|
||||
// to get read(2) error just in case.
|
||||
ev_feed_event(conn_.loop, &conn_.rev, EV_READ);
|
||||
input->drain(input->rleft());
|
||||
do_write_ = &HttpDownstreamConnection::noop;
|
||||
reusable_ = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1287,8 @@ int HttpDownstreamConnection::write_tls() {
|
|||
// part of response body. So keep reading. Invoke read event
|
||||
// to get read(2) error just in case.
|
||||
ev_feed_event(conn_.loop, &conn_.rev, EV_READ);
|
||||
input->drain(input->rleft());
|
||||
do_write_ = &HttpDownstreamConnection::noop;
|
||||
reusable_ = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1445,7 +1448,9 @@ HttpDownstreamConnection::get_downstream_addr_group() const {
|
|||
|
||||
DownstreamAddr *HttpDownstreamConnection::get_addr() const { return addr_; }
|
||||
|
||||
bool HttpDownstreamConnection::poolable() const { return !group_->retired; }
|
||||
bool HttpDownstreamConnection::poolable() const {
|
||||
return !group_->retired && reusable_;
|
||||
}
|
||||
|
||||
const Address *HttpDownstreamConnection::get_raddr() const { return raddr_; }
|
||||
|
||||
|
|
|
@ -112,6 +112,8 @@ private:
|
|||
// true if first write of reused connection succeeded. For
|
||||
// convenience, this is initialized as true.
|
||||
bool reuse_first_write_done_;
|
||||
// true if this object can be reused
|
||||
bool reusable_;
|
||||
};
|
||||
|
||||
} // namespace shrpx
|
||||
|
|
Loading…
Reference in New Issue