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 af0773e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/TCP.Engine.savi
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,28 @@

| IO.Action.Read |
if Platform.is_windows (
None // TODO: @_windows_complete_reads(arg)
@_finish_read_windows(event.arg) -> (yield action)
|
@_pending_reads_unix -> (yield action)
)

// 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 af0773e

Please sign in to comment.