RustToMetal commented on code in PR #4553:
URL: https://github.com/apache/iggy/pull/4553#discussion_r4287572212


##########
foreign/swift/Sources/Iggy/Client/ClientCore.swift:
##########
@@ -736,22 +913,19 @@ actor ClientCore {
         state = .disconnected
         let old = connection
         connection = nil
-        // A Register still in flight is retried on the next connection and
-        // must arrive under the identity and secret its body was built from.
-        if session.isBound {
-            session.reset()
-        }
         await old?.close()

Review Comment:
   Fixed in 902b6612d. `disconnectTransport` now takes the exchange lock for a 
live connection before closing it, so it waits for the reply of a frame another 
caller already wrote, as `disconnect_transport` waits on the link lock in Rust. 
It releases the lock before returning, so the `connect`/`resumeSession` that 
follows in `failOver`, `settle`, or `handleLeaderRedirection` takes it 
normally. The wait runs outside the calling task, so a cancelled caller cannot 
skip the teardown, and after the wait it rechecks the state and the connection 
epoch, in case the caller in flight dropped the connection or a reconnect 
replaced it meanwhile. No caller of `disconnectTransport` holds the exchange 
lock, so it cannot deadlock. Test: `aTeardownWaitsForTheExchangeInFlight`, 
where a write is in flight when the transport is torn down; it gets its reply, 
is sent once, and the next call reconnects. The branch is also merged with 
current master.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to