diff --git a/NucleicRemote/NucleicRemote/Models/HostConnection.swift b/NucleicRemote/NucleicRemote/Models/HostConnection.swift index 0dba1bd..009af0a 100644 --- a/NucleicRemote/NucleicRemote/Models/HostConnection.swift +++ b/NucleicRemote/NucleicRemote/Models/HostConnection.swift @@ -42,6 +42,8 @@ final class HostConnection { guard openSessionID != oldValue else { return } openMaxSeq = nil seenSeq = [] + transcriptFetchRequestID = nil + didStartFullFetch = false } } @@ -50,6 +52,15 @@ final class HostConnection { /// instead of cold-resetting to the 200-event tail (which would truncate a long transcript). private var openMaxSeq: UInt64? + /// The in-flight full-history fetch's request id (mesh full-transcript sync). On open we pull the + /// *whole* transcript — the cold `subscribe` only returns a 200-event tail — and merge its chunks + /// into the transcript on screen; replies are matched on this id so a late batch from a previous + /// open (the session changed underneath us) is dropped. `didStartFullFetch` guards against issuing + /// it twice — both `open` and the reconnect nudge call `fetchFullTranscript`, but only the first + /// that finds a live, capable connection actually sends. + private var transcriptFetchRequestID: String? + private var didStartFullFetch = false + // MARK: Callbacks up to RemoteStore (aggregate concerns) /// How a `HostConnection` talks back to `RemoteStore`. All fire on the main actor.