Commit e91d36c2 authored by MarkG's avatar MarkG Committed by TIGERs GitLab
Browse files

Resolve "Ping the GC as AutoRef regularly to validate the connection"

Closes #1710

See merge request main/Sumatra!1477

sumatra-commit: e3200ded0c4e5aa9921363143551d133c6661b21
parent 0f65af72
Pipeline #17271 passed with stage
in 5 minutes and 56 seconds
......@@ -99,8 +99,9 @@ public class AutoRefToGameControllerConnector implements Runnable
log.error("Receiving AutoRefRegistration reply failed");
} else if (reply.getControllerReply().getStatusCode() != SslGcRcon.ControllerReply.StatusCode.OK)
{
log.error("Server did not allow registration: " + reply.getControllerReply().getStatusCode() + " - "
+ reply.getControllerReply().getReason());
log.error("Server did not allow registration: {} - {}",
reply.getControllerReply().getStatusCode(),
reply.getControllerReply().getReason());
} else
{
log.info("Successfully registered AutoRef");
......@@ -140,7 +141,7 @@ public class AutoRefToGameControllerConnector implements Runnable
public void sendEvent(final IGameEvent event)
{
QueueEntry entry = new QueueEntry(event);
commandQueue.add(entry);
commandQueue.addLast(entry);
}
......@@ -170,10 +171,14 @@ public class AutoRefToGameControllerConnector implements Runnable
private void readWriteLoop() throws InterruptedException
{
QueueEntry entry = commandQueue.take();
QueueEntry entry = commandQueue.pollFirst(1, TimeUnit.SECONDS);
SslGcRconAutoref.AutoRefToController.Builder req = SslGcRconAutoref.AutoRefToController
.newBuilder();
req.setGameEvent(entry.getEvent().toProtobuf());
if (entry != null)
{
req.setGameEvent(entry.getEvent().toProtobuf());
}
if (nextToken != null)
{
......@@ -184,9 +189,11 @@ public class AutoRefToGameControllerConnector implements Runnable
if (!protocol.sendMessage(req.build()))
{
log.info("Put game event '{}' back into queue after lost connection", entry.getEvent());
commandQueue.addFirst(entry);
if (entry != null)
{
log.info("Put game event '{}' back into queue after lost connection", entry.getEvent());
commandQueue.addFirst(entry);
}
return;
}
SslGcRconAutoref.ControllerToAutoRef reply = protocol
......@@ -197,9 +204,9 @@ public class AutoRefToGameControllerConnector implements Runnable
} else if (reply.getControllerReply()
.getStatusCode() != SslGcRcon.ControllerReply.StatusCode.OK)
{
log.warn(
"Remote control rejected command " + entry.getEvent() + " with outcome "
+ reply.getControllerReply().getStatusCode());
log.warn("Remote control rejected entry {} with outcome {}",
entry,
reply.getControllerReply().getStatusCode());
}
if (reply != null)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment