relay patches

This commit is contained in:
LAX1DUDE 2022-09-30 22:32:11 -07:00
parent 34a655f96d
commit 0141a10389
3 changed files with 5 additions and 1 deletions

View file

@ -288,7 +288,7 @@ public class EaglerSPRelay extends WebSocketServer {
String code = ipkt.connectionCode;
logger.debug("[{}]: Connected as a client, requested server code: {}", (String) arg0.getAttachment(), code);
if(code.length() != config.getCodeLength()) {
logger.debug("The code '{}' is invalid because it's the wrong length, disconnecting");
logger.debug("The code '{}' is invalid because it's the wrong length, disconnecting", code);
arg0.send(IPacket.writePacket(new IPacketFFErrorCode(IPacketFFErrorCode.TYPE_CODE_LENGTH,
"The join code is the wrong length, it should be " + config.getCodeLength() + " chars long")));
arg0.close();

View file

@ -44,6 +44,10 @@ public class IPacket {
}
IPacket pkt = clazz.newInstance();
pkt.read(input);
int j = input.available();
if(j > 0) {
throw new IOException("Packet type " + i + " had " + j + " remaining bytes");
}
return pkt;
} catch (InstantiationException | IllegalAccessException e) {
EaglerSPRelay.logger.error("Could not instanciate packet {}", i);

Binary file not shown.