Skip to content

Commit

Permalink
Fix FakeSharedWebTransport
Browse files Browse the repository at this point in the history
Summary: resetStream twice would throw an exception, so don't internally reset a non-open stream

Reviewed By: mjoras

Differential Revision: D66563102

fbshipit-source-id: 61763cab15b38c1626a3509938ff5cd448e8a963
  • Loading branch information
afrind authored and facebook-github-bot committed Dec 2, 2024
1 parent 1cf2c66 commit 33b74e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion proxygen/lib/http/webtransport/test/FakeSharedWebTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class FakeStreamHandle
return folly::unit;
}

bool open() const {
return !fin_ && !writeErr_ && (!promise_ || !promise_->isFulfilled());
}

uint64_t id{0};
folly::CancellationSource cs_;
folly::Optional<folly::Promise<WebTransport::StreamData>> promise_;
Expand Down Expand Up @@ -221,7 +225,9 @@ class FakeSharedWebTransport : public WebTransport {
folly::Expected<folly::Unit, ErrorCode> closeSession(
folly::Optional<uint32_t> error = folly::none) override {
for (auto& h : writeHandles) {
h.second->resetStream(std::numeric_limits<uint32_t>::max());
if (h.second->open()) {
h.second->resetStream(std::numeric_limits<uint32_t>::max());
}
}
writeHandles.clear();
for (auto& h : readHandles) {
Expand Down

0 comments on commit 33b74e2

Please sign in to comment.