From d292413b41b1cf04e8b42d8c2d6c56418a5917d8 Mon Sep 17 00:00:00 2001 From: Joe Eli McIlvain Date: Wed, 15 Feb 2023 15:16:44 -0800 Subject: [PATCH] Update for latest `IO` library changes. The new `IO` library has an `IO.Action.NotHandled` action, which `IO.CoreEngine` uses to indicate that it doesn't own the event. It is now the responsibility of `TCP.Engine` to handle such situations instead of making `IO.CoreEngine` handle it. --- src/TCP.Engine.savi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/TCP.Engine.savi b/src/TCP.Engine.savi index 0a60cd4..b68bba0 100644 --- a/src/TCP.Engine.savi +++ b/src/TCP.Engine.savi @@ -93,6 +93,20 @@ // TODO: windows complete writes, flush-after-mute (pending writes logic from Pony) // | IO.Action.Write | // ... + + | IO.Action.NotHandled | + // If the underlying engine didn't want to handle this event, it means + // this is likely a later connection attempt after we already had one. + // If we have more connection attempts pending, we'll unsubscribe it. + if (@_pending_connect_count > 0) ( + @_pending_connect_count -= 1 + _FFI.pony_asio_event_unsubscribe(event.id) + | + // If we have no more pending connection attempts, pass the buck to + // the caller to figure out what needs to be done with this event. + // Maybe they have another engine sharing the same IO actor, perhaps. + yield action + ) | yield action )