Skip to content

Commit

Permalink
Update for latest IO library changes.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jemc committed Feb 15, 2023
1 parent a29ec1c commit d292413
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/TCP.Engine.savi
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit d292413

Please sign in to comment.