Skip to content

Commit

Permalink
Fix some compile issues; use new loop method
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Mar 16, 2024
1 parent dd84735 commit b1a636f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/socket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,18 @@ extension [SocketType](socket: SocketType)
: SocketService raises BindError =

val binding = bindable.bind(socket)
var continue: Boolean = true

val async = Async:
while continue do
val connection = bindable.connect(binding)
Async(bindable.transmit(binding, connection, lambda(connection)))
val bindLoop = loop:
val connection = bindable.connect(binding)
async(bindable.transmit(binding, connection, lambda(connection)))

val task = async(bindLoop.start())

new SocketService:
def stop(): Unit =
continue = false
bindLoop.stop()
bindable.stop(binding)
safely(async.await())
safely(task.await())

extension [EndpointType](endpoint: EndpointType)
def connect[StateType](initialState: StateType)[MessageType](initialMessage: MessageType = Bytes())
Expand Down

0 comments on commit b1a636f

Please sign in to comment.