Skip to content

Commit

Permalink
Merge pull request #523 from lenguyenthanh/random-code-tweak
Browse files Browse the repository at this point in the history
Random code tweak
  • Loading branch information
ornicar authored Feb 18, 2024
2 parents a3f2d9a + c594465 commit 10b4b18
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/Chess.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object Chess:
Monitor.time(_.chessMoveTime):
try
chess
.Game(req.variant.some, Some(req.fen))(req.orig, req.dest, req.promotion)
.Game(req.variant.some, req.fen.some)(req.orig, req.dest, req.promotion)
.map((game, move) => makeNode(game, Uci.WithSan(Uci(move), move.san), req.path, req.chapterId))
.getOrElse(ClientIn.StepFailure)
catch
Expand All @@ -31,7 +31,7 @@ object Chess:
Monitor.time(_.chessMoveTime):
try
chess
.Game(req.variant.some, Some(req.fen))
.Game(req.variant.some, req.fen.some)
.drop(req.role, req.square)
.map((game, drop) => makeNode(game, Uci.WithSan(Uci(drop), drop.san), req.path, req.chapterId))
.getOrElse(ClientIn.StepFailure)
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/netty/ActorChannelConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import io.netty.util.concurrent.{ Future as NettyFuture, GenericFutureListener }
import ipc.ClientIn
import io.netty.handler.codec.http.websocketx.*
import io.netty.buffer.Unpooled
import lila.ws.util.RequestUri

final private class ActorChannelConnector(router: Router, clients: ActorRef[Clients.Control])(using Executor):
final private class ActorChannelConnector(clients: ActorRef[Clients.Control])(using Executor):

def apply(endpoint: Endpoint, channel: Channel): Unit =
val clientPromise = Promise[Client]()
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/netty/FrameHandler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import io.netty.handler.codec.http.websocketx.*

import ipc.ClientOut

final private class FrameHandler(connector: ActorChannelConnector)(using Executor)
extends SimpleChannelInboundHandler[WebSocketFrame]:
final private class FrameHandler(using Executor) extends SimpleChannelInboundHandler[WebSocketFrame]:

import FrameHandler.*
import ProtocolHandler.key
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/netty/NettyServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class NettyServer(
config: Config
)(using Executor):

private val connector = ActorChannelConnector(router, clients)
private val connector = ActorChannelConnector(clients)
private val logger = Logger(getClass)

def start(): Unit =
Expand Down Expand Up @@ -60,7 +60,7 @@ final class NettyServer(
pipeline.addLast(HttpObjectAggregator(4096))
pipeline.addLast(RequestHandler(router))
pipeline.addLast(ProtocolHandler(connector))
pipeline.addLast(FrameHandler(connector))
pipeline.addLast(FrameHandler())
)

val server = boot.bind(port).sync().channel()
Expand Down

0 comments on commit 10b4b18

Please sign in to comment.