Skip to content

Commit

Permalink
Fixed server getting stuck when hosting
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Jan 12, 2018
1 parent 5fc5d7c commit 77d8464
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ allprojects {
appName = "Mindustry"
gdxVersion = '1.9.8'
aiVersion = '1.8.1'
uCoreVersion = '459e8ae';
uCoreVersion = '2254516';
}

repositories {
Expand Down
11 changes: 7 additions & 4 deletions kryonet/src/io/anuke/kryonet/KryoServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ public boolean onDiscoverHost(DatagramChannel datagramChannel, InetSocketAddress
}
});

Thread thread = new Thread(server, "Kryonet Server");
thread.setDaemon(true);
thread.start();
server.addListener(new Listener(){

@Override
Expand Down Expand Up @@ -125,11 +122,17 @@ public void kick(int connection) {
@Override
public void host(int port) throws IOException {
server.bind(port, port);

Thread thread = new Thread(server, "Kryonet Server");
thread.setDaemon(true);
thread.start();
}

@Override
public void close() {
server.close();
UCore.setPrivate(server, "shutdown", true);

new Thread(() -> server.close()).run();
}

@Override
Expand Down

0 comments on commit 77d8464

Please sign in to comment.