relay patches
This commit is contained in:
parent
34a655f96d
commit
0141a10389
|
@ -288,7 +288,7 @@ public class EaglerSPRelay extends WebSocketServer {
|
||||||
String code = ipkt.connectionCode;
|
String code = ipkt.connectionCode;
|
||||||
logger.debug("[{}]: Connected as a client, requested server code: {}", (String) arg0.getAttachment(), code);
|
logger.debug("[{}]: Connected as a client, requested server code: {}", (String) arg0.getAttachment(), code);
|
||||||
if(code.length() != config.getCodeLength()) {
|
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,
|
arg0.send(IPacket.writePacket(new IPacketFFErrorCode(IPacketFFErrorCode.TYPE_CODE_LENGTH,
|
||||||
"The join code is the wrong length, it should be " + config.getCodeLength() + " chars long")));
|
"The join code is the wrong length, it should be " + config.getCodeLength() + " chars long")));
|
||||||
arg0.close();
|
arg0.close();
|
||||||
|
|
|
@ -44,6 +44,10 @@ public class IPacket {
|
||||||
}
|
}
|
||||||
IPacket pkt = clazz.newInstance();
|
IPacket pkt = clazz.newInstance();
|
||||||
pkt.read(input);
|
pkt.read(input);
|
||||||
|
int j = input.available();
|
||||||
|
if(j > 0) {
|
||||||
|
throw new IOException("Packet type " + i + " had " + j + " remaining bytes");
|
||||||
|
}
|
||||||
return pkt;
|
return pkt;
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
EaglerSPRelay.logger.error("Could not instanciate packet {}", i);
|
EaglerSPRelay.logger.error("Could not instanciate packet {}", i);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user