Skip to content

Commit 33b74e2

Browse files
afrindfacebook-github-bot
authored andcommitted
Fix FakeSharedWebTransport
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
1 parent 1cf2c66 commit 33b74e2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

proxygen/lib/http/webtransport/test/FakeSharedWebTransport.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ class FakeStreamHandle
8787
return folly::unit;
8888
}
8989

90+
bool open() const {
91+
return !fin_ && !writeErr_ && (!promise_ || !promise_->isFulfilled());
92+
}
93+
9094
uint64_t id{0};
9195
folly::CancellationSource cs_;
9296
folly::Optional<folly::Promise<WebTransport::StreamData>> promise_;
@@ -221,7 +225,9 @@ class FakeSharedWebTransport : public WebTransport {
221225
folly::Expected<folly::Unit, ErrorCode> closeSession(
222226
folly::Optional<uint32_t> error = folly::none) override {
223227
for (auto& h : writeHandles) {
224-
h.second->resetStream(std::numeric_limits<uint32_t>::max());
228+
if (h.second->open()) {
229+
h.second->resetStream(std::numeric_limits<uint32_t>::max());
230+
}
225231
}
226232
writeHandles.clear();
227233
for (auto& h : readHandles) {

0 commit comments

Comments
 (0)