Fix inconsistent invocation of MoqtResponseCallback. When an application initiates a request via MoqtSessionInterface, a return of false or nullptr indicates that the request was never sent due to a variety of local restrictions. After discussing with @vasilvv, these cases should not invoke the provided MoqtResponseCallback. Not in production. PiperOrigin-RevId: 963545134
diff --git a/quiche/quic/moqt/moqt_session.cc b/quiche/quic/moqt/moqt_session.cc index 753e5ba..4b7c3a6 100644 --- a/quiche/quic/moqt/moqt_session.cc +++ b/quiche/quic/moqt/moqt_session.cc
@@ -296,9 +296,6 @@ return nullptr; } if (!outgoing_subscribe_namespace_.SubscribeNamespace(prefix)) { - std::move(response_callback)(MoqtRequestErrorInfo{ - RequestErrorCode::kInternalError, std::nullopt, - "SUBSCRIBE_NAMESPACE already outstanding for namespace"}); return nullptr; } std::unique_ptr<MoqtSubscribeNamespaceRequestStream> state = @@ -353,16 +350,11 @@ QUICHE_DCHECK(name.IsValid()); if (received_goaway_ || sent_goaway_) { QUIC_DLOG(INFO) << ENDPOINT << "Tried to send TRACK_STATUS after GOAWAY"; - std::move(response_callback)(MoqtRequestErrorInfo{ - RequestErrorCode::kGoingAway, std::nullopt, "GOAWAY received"}); return false; } webtransport::Stream* stream = session_->OpenOutgoingBidirectionalStream(); if (stream == nullptr) { - std::move(response_callback)( - MoqtRequestErrorInfo{RequestErrorCode::kInternalError, std::nullopt, - "Flow control blocked"}); return false; }
diff --git a/quiche/quic/moqt/moqt_session_interface.h b/quiche/quic/moqt/moqt_session_interface.h index 4d0801e..1af02d8 100644 --- a/quiche/quic/moqt/moqt_session_interface.h +++ b/quiche/quic/moqt/moqt_session_interface.h
@@ -96,6 +96,12 @@ // Close the session with a fatal error. virtual void Error(MoqtError code, absl::string_view error) = 0; + // Many of these functions initiate a request and take MoqtResponseCallback to + // report the peer's response. These functions return false if there is an + // immediate problem that prevents sending the request, in which case the + // callback will not be invoked. For example, there might not be stream credit + // to open a request stream, or the request is a duplicate, or the session + // is in a GOAWAY state. // Return true if SUBSCRIBE was actually sent. virtual bool Subscribe(const FullTrackName& name, SubscribeVisitor* absl_nonnull visitor, @@ -188,7 +194,7 @@ // Sends TRACK_STATUS request to the peer. Returns `false` if the request // immediately fails (usually due to flow control), and `true` otherwise; - // `response_callback` will be eventually invoked in either case. + // `response_callback` will be eventually invoked if true. virtual bool TrackStatus(const FullTrackName& name, const MessageParameters& parameters, MoqtResponseCallback response_callback) = 0;