Skip to content
Closed
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
3 changes: 3 additions & 0 deletions proxygen/lib/http/session/HTTPTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,9 @@ class HTTPTransaction
if (!isEgressEOMSeen()) {
sendEOM();
}
if (!isIngressEOMSeen()) {
sendAbort(ErrorCode::NO_ERROR);
}

return folly::unit;
}
Expand Down
21 changes: 19 additions & 2 deletions proxygen/lib/http/session/test/HQUpstreamSessionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2230,12 +2230,23 @@ class HQUpstreamSessionTestWebTransport : public HQUpstreamSessionTest {
return handler;
}

// Local-initiated close: app calls closeSession() before ingress EOF.
// closeSession() sends EOM + stop-sending (abort with NO_ERROR).
void closeWTSession() {
// should this close INGRESS?
handler_->expectDetachTransaction();
wt_->closeSession();
hqSession_->closeWhenIdle();
flushAndLoop();
}

// Peer-initiated close: peer sends EOF first, then local app closes.
// closeSession() sends only EOM (no abort since ingress EOM already seen).
void peerCloseWTSession() {
handler_->expectEOM();
handler_->expectDetachTransaction();
socketDriver_->addReadEOF(sessionId_, std::chrono::milliseconds(0));
flushAndLoopN(1);
wt_->closeSession();
handler_->expectDetachTransaction();
hqSession_->closeWhenIdle();
flushAndLoop();
}
Expand Down Expand Up @@ -2282,6 +2293,12 @@ TEST_P(HQUpstreamSessionTestWebTransport, FilterInstallation) {
closeWTSession();
}

// Test peer-initiated close: peer sends EOF first, then local app closes.
// closeSession() sends only EOM (no stop-sending needed).
TEST_P(HQUpstreamSessionTestWebTransport, PeerClose) {
peerCloseWTSession();
}

TEST_P(HQUpstreamSessionTestWebTransport, BidirectionalStream) {
InSequence enforceOrder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ class HTTPTransactionWebTransportTest : public testing::Test {

void TearDown() override {
if (txn_) {
EXPECT_CALL(transport_, sendAbort(txn_.get(), _));
// closeSession() may have already sent an abort if ingress EOM was not
// seen, so allow 0 or 1 calls here.
EXPECT_CALL(transport_, sendAbort(txn_.get(), _)).Times(AtMost(1));
txn_->sendAbort();
}
}
Expand Down Expand Up @@ -206,6 +208,7 @@ TEST_F(HTTPTransactionWebTransportTest, CreateStreams) {
WebTransport::ErrorCode::STREAM_CREATION_ERROR);

EXPECT_CALL(transport_, sendEOM(txn_.get(), nullptr));
EXPECT_CALL(transport_, sendAbort(txn_.get(), _));
wt_->closeSession();
}

Expand Down
Loading