Fixed Kryo crash

This commit is contained in:
Anuken
2018-01-01 18:01:24 -05:00
parent 20eea3b385
commit c8e41c08ea
6 changed files with 33 additions and 11 deletions

View File

@@ -26,13 +26,25 @@ public class KryoClient implements ClientProvider{
Connect c = new Connect();
c.id = connection.getID();
c.addressTCP = connection.getRemoteAddressTCP().toString();
Net.handleClientReceived(c);
try{
Net.handleClientReceived(c);
}catch (Exception e){
Gdx.app.exit();
throw new RuntimeException(e);
}
}
@Override
public void disconnected (Connection connection) {
Disconnect c = new Disconnect();
Net.handleClientReceived(c);
try{
Net.handleClientReceived(c);
}catch (Exception e){
Gdx.app.exit();
throw new RuntimeException(e);
}
}
@Override

View File

@@ -31,20 +31,34 @@ public class KryoServer implements ServerProvider {
thread.setDaemon(true);
thread.start();
server.addListener(new Listener(){
@Override
public void connected (Connection connection) {
Connect c = new Connect();
c.id = connection.getID();
c.addressTCP = connection.getRemoteAddressTCP().toString();
Net.handleServerReceived(c, c.id);
connections.add(c.id);
try {
Net.handleServerReceived(c, c.id);
connections.add(c.id);
}catch (Exception e){
Gdx.app.exit();
throw new RuntimeException(e);
}
}
@Override
public void disconnected (Connection connection) {
Disconnect c = new Disconnect();
c.id = connection.getID();
Net.handleServerReceived(c, c.id);
try{
Net.handleServerReceived(c, c.id);
}catch (Exception e){
Gdx.app.exit();
throw new RuntimeException(e);
}
connections.removeValue(c.id);
}