Commit bb8cbe74 authored by Kenton Varda's avatar Kenton Varda

Don't let onDrained() go into infinite promise loop.

parent 05a04e02
...@@ -3060,7 +3060,7 @@ public: ...@@ -3060,7 +3060,7 @@ public:
KJ_IF_MAYBE(c, client) { KJ_IF_MAYBE(c, client) {
return c->get()->isDrained(); return c->get()->isDrained();
} else { } else {
return false; return failed;
} }
} }
...@@ -3070,8 +3070,9 @@ public: ...@@ -3070,8 +3070,9 @@ public:
} else { } else {
return promise.addBranch().then([this]() { return promise.addBranch().then([this]() {
return KJ_ASSERT_NONNULL(client)->onDrained(); return KJ_ASSERT_NONNULL(client)->onDrained();
}, [](kj::Exception&& e) { }, [this](kj::Exception&& e) {
// Connecting failed. Treat as immediately drained. // Connecting failed. Treat as immediately drained.
failed = true;
return kj::READY_NOW; return kj::READY_NOW;
}); });
} }
...@@ -3117,6 +3118,7 @@ public: ...@@ -3117,6 +3118,7 @@ public:
private: private:
kj::ForkedPromise<void> promise; kj::ForkedPromise<void> promise;
kj::Maybe<kj::Own<NetworkAddressHttpClient>> client; kj::Maybe<kj::Own<NetworkAddressHttpClient>> client;
bool failed = false;
}; };
class NetworkHttpClient final: public HttpClient, private kj::TaskSet::ErrorHandler { class NetworkHttpClient final: public HttpClient, private kj::TaskSet::ErrorHandler {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment