diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/DisconnectSegment.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/DisconnectSegment.java index a2fb0de..93f62a2 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/DisconnectSegment.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/DisconnectSegment.java @@ -22,7 +22,7 @@ public class DisconnectSegment implements Segment { public void processRequests(Packet packet, List carrier, AtomicBoolean abort) { Logger.trace("DisconnectSegment received {} requests.", packet.size()); if (packet.containsRequestOfType(RequestType.DisconnectRequest)) { - Logger.debug("Player {} sent DisconnectRequest", packet.getOrigin().type); + Logger.debug("Player of Type {} sent DisconnectRequest", packet.getOrigin().type); parent.connection.removePlayer(packet.getOrigin()); if (packet.getOrigin().type != ParticipantType.Spectator) { @@ -33,7 +33,7 @@ public class DisconnectSegment implements Segment { parent.generateWin(parent.connection.getPlayer2()); } } + packet.clear(); } - packet.clear(); } } diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegment.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegment.java index 4b70079..5b4b71f 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegment.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegment.java @@ -22,11 +22,13 @@ public class GameStateSegment implements Segment { public void processRequests(Packet packet, List carrier, AtomicBoolean abort) { Logger.trace("GameStateSegment received {} requests.", packet.size()); var result = game.checkRequestsAndApply(packet.toArray(new Request[0])); - Logger.trace("GameLogic gener"); + Logger.trace("GameLogic generated {} events", result.map(List::size).orElse(0)); if (result.isPresent()) { + Logger.trace("Result from GameLogic is present. Adding requests to carrier."); carrier.addAll(result.get()); packet.clear(); } else { + Logger.debug("Result from GameLogic is invalid. Triggering error."); abort.set(true); } } diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/PauseSegment.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/PauseSegment.java index 243e07e..eb4b8b1 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/PauseSegment.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/PauseSegment.java @@ -97,10 +97,8 @@ public class PauseSegment implements Segment { RequestType.MoveRequest, RequestType.ExchangeInfinityStoneRequest, RequestType.UseInfinityStoneRequest, - RequestType.EndRoundRequest, - RequestType.PauseStopRequest, - RequestType.PauseStartRequest); - + RequestType.EndRoundRequest); } + packet.removeRequestsOfTypes(RequestType.PauseStopRequest, RequestType.PauseStartRequest); } } diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameStateSegment.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameStateSegment.java index c29b0df..18d5b8b 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameStateSegment.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/pipelining/RequestGameStateSegment.java @@ -1,5 +1,6 @@ package uulm.teamname.marvelous.server.lobby.pipelining; +import org.tinylog.Logger; import uulm.teamname.marvelous.gamelibrary.events.Event; import uulm.teamname.marvelous.gamelibrary.gamelogic.GameInstance; import uulm.teamname.marvelous.gamelibrary.requests.RequestBuilder; @@ -19,9 +20,11 @@ public class RequestGameStateSegment implements Segment { @Override public void processRequests(Packet packet, List carrier, AtomicBoolean abort) { + Logger.trace("RequestGameStateSegment received {} requests", packet.size()); if (packet.containsRequestOfType(RequestType.Req)) { + Logger.trace("Req event found. Returning Gamestate, and clearing entire RequestList"); carrier.add(game.getGameStateEvent()); + packet.clear(); } - packet.clear(); } }