kryonet icon indicating copy to clipboard operation
kryonet copied to clipboard

Server disposing

Open ghost opened this issue 10 years ago • 1 comments

Hi should we not dispose the server?

I open the connection like in the readme explained and then when I close the app I get the error

00:00  INFO: [kryonet] Server opened.
00:02  INFO: [kryonet] Server closed.
Exception in thread "Server" java.nio.channels.ClosedSelectorException
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
    at sun.nio.ch.SelectorImpl.select(Unknown Source)
    at com.esotericsoftware.kryonet.Server.update(Server.java:168)
    at com.esotericsoftware.kryonet.Server.run(Server.java:372)
    at java.lang.Thread.run(Unknown Source)

If I remove

@Override
public void onDispose() {
    try {
        server.dispose();
    }
    catch (IOException e) {
        e.printStackTrace();
    }
}

there are no errors.

ghost avatar Jan 20 '15 14:01 ghost

Same thing here, on the Client side. Calling client.dispose() inside libGDX's dispose() method actually hangs for several minutes before letting my game close.

If I remove client.dispose(), everything works fine.

Under what circumstances are we stupposed to dispose ?

payne911 avatar Jun 12 '20 22:06 payne911