Skip to content

Commit

Permalink
Fix WebTransport crash on socket close
Browse files Browse the repository at this point in the history
Summary: If the socket closes with open webtrans streams, we will error them, but don't need to touch the socket again.

Reviewed By: hanidamlaj

Differential Revision: D53477311

fbshipit-source-id: 0a18b4112912306c696b88b04248e425fd243a90
  • Loading branch information
afrind authored and facebook-github-bot committed Feb 23, 2024
1 parent 3b6ef64 commit 9f93974
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions proxygen/lib/http/session/HQSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3831,10 +3831,13 @@ HQSession::HQStreamTransport::sendWebTransportStreamData(
folly::Expected<folly::Unit, WebTransport::ErrorCode>
HQSession::HQStreamTransport::resetWebTransportEgress(HTTPCodec::StreamID id,
uint32_t errorCode) {
auto res = session_.sock_->resetStream(
id, quic::ApplicationErrorCode(WebTransport::toHTTPErrorCode(errorCode)));
if (res.hasError()) {
return folly::makeUnexpected(WebTransport::ErrorCode::GENERIC_ERROR);
if (session_.sock_) {
auto res = session_.sock_->resetStream(
id,
quic::ApplicationErrorCode(WebTransport::toHTTPErrorCode(errorCode)));
if (res.hasError()) {
return folly::makeUnexpected(WebTransport::ErrorCode::GENERIC_ERROR);
}
}
return folly::unit;
}
Expand All @@ -3861,12 +3864,14 @@ HQSession::HQStreamTransport::resumeWebTransportIngress(
folly::Expected<folly::Unit, WebTransport::ErrorCode>
HQSession::HQStreamTransport::stopReadingWebTransportIngress(
HTTPCodec::StreamID id, uint32_t errorCode) {
auto res = session_.sock_->setReadCallback(
id,
nullptr,
quic::ApplicationErrorCode(WebTransport::toHTTPErrorCode(errorCode)));
if (res.hasError()) {
return folly::makeUnexpected(WebTransport::ErrorCode::GENERIC_ERROR);
if (session_.sock_) {
auto res = session_.sock_->setReadCallback(
id,
nullptr,
quic::ApplicationErrorCode(WebTransport::toHTTPErrorCode(errorCode)));
if (res.hasError()) {
return folly::makeUnexpected(WebTransport::ErrorCode::GENERIC_ERROR);
}
}
return folly::unit;
}
Expand Down

0 comments on commit 9f93974

Please sign in to comment.