Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -973,9 +973,9 @@ HttpSM::state_watch_for_client_abort(int event, void *data)
* client.
*/
case VC_EVENT_EOS: {
// We got an early EOS.
// We got an early EOS. If the tunnal has cache writer, don't kill it for background fill.
NetVConnection *netvc = ua_txn->get_netvc();
if (ua_txn->allow_half_open()) {
if (ua_txn->allow_half_open() || tunnel.has_consumer_besides_client()) {
if (netvc) {
netvc->do_io_shutdown(IO_SHUTDOWN_READ);
}
Expand Down
26 changes: 26 additions & 0 deletions proxy/http/HttpTunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class HttpTunnel : public Continuation
}
bool is_tunnel_alive() const;
bool has_cache_writer() const;
bool has_consumer_besides_client() const;

HttpTunnelProducer *add_producer(VConnection *vc, int64_t nbytes, IOBufferReader *reader_start, HttpProducerHandler sm_handler,
HttpTunnelType_t vc_type, const char *name);
Expand Down Expand Up @@ -513,6 +514,31 @@ HttpTunnel::has_cache_writer() const
return false;
}

/**
Return false if there is only a consumer for client
*/
inline bool
HttpTunnel::has_consumer_besides_client() const
{
bool res = true;

for (const auto &consumer : consumers) {
if (!consumer.alive) {
continue;
}

if (consumer.vc_type == HT_HTTP_CLIENT) {
res = false;
continue;
} else {
res = true;
break;
}
}

return res;
}

inline bool
HttpTunnelConsumer::is_downstream_from(VConnection *vc)
{
Expand Down