diff --git a/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteMessages.kt b/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteMessages.kt index b55f2e0ee..66e75df97 100644 --- a/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteMessages.kt +++ b/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteMessages.kt @@ -73,6 +73,17 @@ enum class MoqLiteControlType( Subscribe(2L), Fetch(3L), Probe(4L), + + /** + * Graceful relay-shutdown signal. moq-rs's `Publisher::run` accepts + * `ControlType::Goaway = 5` (`rs/moq-lite/src/lite/publisher.rs`) + * to migrate a publisher to a different relay node. We don't act + * on it today — recognising the type code prevents + * [MoqLiteSession.handleInboundBidi] from silently FINing the + * bidi as an unknown control type, which would lose the relay's + * shutdown notification. Wire body decoding is left as a follow-up. + */ + Goaway(5L), ; companion object { diff --git a/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteSession.kt b/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteSession.kt index 961f9cfe9..4b7f3cbe1 100644 --- a/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteSession.kt +++ b/nestsClient/src/commonMain/kotlin/com/vitorpamplona/nestsclient/moq/lite/MoqLiteSession.kt @@ -953,6 +953,25 @@ class MoqLiteSession internal constructor( runCatching { bidi.finish() } dispatched = true } + + MoqLiteControlType.Goaway -> { + // Relay's graceful-shutdown signal — see + // [MoqLiteControlType.Goaway]. We don't + // act on the migration request today + // (no body decode, no preferred-relay + // failover); the `connectReconnecting*` + // wrappers' transport-loss reconnect path + // already handles the eventual hard + // disconnect, so all this arm needs to do + // is recognise the type code and FIN + // cleanly instead of treating it as an + // unknown control. Logged so a relay- + // initiated migration shows up in logcat + // rather than as a mystery silent reconnect. + Log.w("NestRx") { "Goaway received from relay — FIN bidi (no migration handler today)" } + runCatching { bidi.finish() } + dispatched = true + } } } // Post-dispatch chunks are silently discarded —