Commit 7405f5cc authored by Kenton Varda's avatar Kenton Varda

Fix bug where receiving EOF on the RPC connection could cause RpcConnectionState…

Fix bug where receiving EOF on the RPC connection could cause RpcConnectionState to go into an infinite promise loop.  Strange that this did not cause trouble earlier.  Also some minor tweaks.
parent 9837177b
......@@ -922,6 +922,7 @@ public:
template <typename T>
Orphan(Orphan<T>&&);
Orphan(Orphan<AnyPointer>&&);
Orphan(void*) = delete; // So Orphan(bool) doesn't accept pointers.
KJ_DISALLOW_COPY(Orphan);
Orphan& operator=(Orphan&&) = default;
......
......@@ -307,7 +307,6 @@ public:
}
void taskFailed(kj::Exception&& exception) override {
KJ_LOG(ERROR, "Closing connection due to protocol error.", exception);
disconnect(kj::mv(exception));
}
......@@ -1808,17 +1807,19 @@ private:
[this](kj::Maybe<kj::Own<IncomingRpcMessage>>&& message) {
KJ_IF_MAYBE(m, message) {
handleMessage(kj::mv(*m));
return true;
} else {
disconnect(kj::Exception(
kj::Exception::Nature::PRECONDITION, kj::Exception::Durability::PERMANENT,
__FILE__, __LINE__, kj::str("Peer disconnected.")));
return false;
}
}).then([this]() {
}).then([this](bool keepGoing) {
// No exceptions; continue loop.
//
// (We do this in a separate continuation to handle the case where exceptions are
// disabled.)
tasks.add(messageLoop());
if (keepGoing) tasks.add(messageLoop());
});
}
......
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