Skip to content

Commit

Permalink
Merge pull request #20 from repr-man/main
Browse files Browse the repository at this point in the history
Remove parens that stop compiler spec from passing
  • Loading branch information
jemc committed Jun 21, 2023
2 parents 0bbf2af + cd10595 commit 5cd3994
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion spec/TCP.Spec.savi
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
@env.err.print("[EchoClient] Failed to connect.")

| IO.Action.Read |
if (@io.read_stream.bytes_ahead_of_marker >= b"Hello, World!".size) (
if @io.read_stream.bytes_ahead_of_marker >= b"Hello, World!".size (
bytes val = @io.read_stream.extract_all
@env.err.print("[EchoClient] Received: \(Inspect[bytes])")
@io.close
Expand Down
10 changes: 5 additions & 5 deletions src/TCP.Engine.savi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

// If we failed to resolve any valid connection attempts, send the actor
// a later IO action that will let it know that connection has failed.
if (@_pending_connect_count == 0) (
if @_pending_connect_count == 0 (
actor.io_deferred_action(IO.Action.OpenFailed)
)

Expand All @@ -53,7 +53,7 @@
:yields IO.Action
// If we haven't adopted an event yet, and this one is ready to be adopted,
// try to adopt it now, as we expect it is one of our pending connections.
if (@io.is_waiting_to_open && event.is_writable) (
if @io.is_waiting_to_open && event.is_writable (
try (
@_pending_connect_count -= 1
@io.adopt_event!(event)
Expand All @@ -62,7 +62,7 @@
// We failed to adopt it because it was a failed connection attempt.
// If there are no more pending connection attempts, our last one has
// failed and we have no choice but to admit final failure.
if (@_pending_connect_count == 0) (
if @_pending_connect_count == 0 (
yield IO.Action.OpenFailed
)

Expand Down Expand Up @@ -98,7 +98,7 @@
// 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) (
if @_pending_connect_count > 0 (
@_pending_connect_count -= 1
_FFI.pony_asio_event_unsubscribe(event.id)
|
Expand Down Expand Up @@ -141,7 +141,7 @@
while @io.is_readable (
try (
bytes_read = @read_stream.receive_from!(@io)
if (bytes_read > 0) (yield None)
if bytes_read > 0 (yield None)
)
)

Expand Down
12 changes: 6 additions & 6 deletions src/TCP.Listen.Engine.savi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@_listen_netaddr!.ip_address_with_port_number

:fun _listen_netaddr!
error! if (@_fd == -1)
error! if @_fd == -1
_NetAddress._for_fd(@_fd)

:new (@_actor, ticket TCP.Listen.Ticket, @_limit = 0)
Expand All @@ -48,7 +48,7 @@

// TODO: Delegate much of the AsioEvent internals to an `IO.CoreEngine`.
:fun ref react(event AsioEvent) @
if (event.id === @_event_id) (
if event.id === @_event_id (
if event.is_readable (
yield IO.Action.Read
)
Expand All @@ -67,7 +67,7 @@
|
if @_closed.not (
try (
while (@_limit == 0 || @_count < @_limit) (
while @_limit == 0 || @_count < @_limit (
conn_fd = _FFI.pony_os_accept(@_event_id)
case conn_fd == (
| 0 | error! // EWOULDBLOCK, don't try again
Expand All @@ -83,12 +83,12 @@
)

:fun ref deferred_action(action IO.Action)
if (action == IO.Action.ClosedChild) (
if action == IO.Action.ClosedChild (
@_count -= 1

// If releasing this connection takes us below the limit,
// unpause acceptance and try to accept more connections.
if (@_paused && @_count < @_limit) (
if @_paused && @_count < @_limit (
@_paused = False
yield IO.Action.Read
)
Expand All @@ -98,7 +98,7 @@
@

:fun ref close
if (@_closed.not && @_event_id.is_not_null) (
if @_closed.not && @_event_id.is_not_null (
// When not on windows, unsubscribe immediately here instead of later.
if Platform.is_windows.not _FFI.pony_asio_event_unsubscribe(@_event_id)

Expand Down

0 comments on commit 5cd3994

Please sign in to comment.