Skip to content

Commit 66e3936

Browse files
committed
fix: minor feedback fix
1 parent 3378ed1 commit 66e3936

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

libs/internal/src/fdv2_protocol_handler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ FDv2ProtocolHandler::Result FDv2ProtocolHandler::HandleServerIntent(
120120
}
121121
auto const& intent = **result;
122122
if (intent.payloads.empty()) {
123+
// The protocol requires exactly one payload per server-intent, so
124+
// an empty payloads array is a spec violation. Reset to avoid
125+
// leaking accumulated state from a prior incomplete transfer.
126+
Reset();
123127
return std::monostate{};
124128
}
125129
// The protocol defines exactly one payload per intent.
@@ -242,6 +246,8 @@ FDv2ProtocolHandler::Result FDv2ProtocolHandler::HandleGoodbye(
242246
auto result =
243247
boost::json::value_to<tl::expected<std::optional<Goodbye>, JsonError>>(
244248
data);
249+
// Parse failures are intentionally ignored: the caller should rotate
250+
// sources regardless of whether the reason field is readable.
245251
if (!result) {
246252
return Goodbye{std::nullopt};
247253
}

0 commit comments

Comments
 (0)