mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-27 17:00:34 +01:00
Handle rcon timeouts properly
This commit is contained in:
parent
87600345cb
commit
0942b1861b
1 changed files with 10 additions and 1 deletions
|
@ -17,6 +17,13 @@ public class RemoteControlSession extends RemoteConnectionThread {
|
||||||
RemoteControlSession(IMinecraftServer iminecraftserver, Socket socket) {
|
RemoteControlSession(IMinecraftServer iminecraftserver, Socket socket) {
|
||||||
super(iminecraftserver);
|
super(iminecraftserver);
|
||||||
this.h = socket;
|
this.h = socket;
|
||||||
|
// CraftBukkit start - set infinite timeout so we sleep until there is data available
|
||||||
|
try {
|
||||||
|
this.h.setSoTimeout(0);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.running = false;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
this.j = iminecraftserver.a("rcon.password", "");
|
this.j = iminecraftserver.a("rcon.password", "");
|
||||||
this.info("Rcon connection from: " + socket.getInetAddress());
|
this.info("Rcon connection from: " + socket.getInetAddress());
|
||||||
}
|
}
|
||||||
|
@ -83,8 +90,9 @@ public class RemoteControlSession extends RemoteConnectionThread {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return; // CraftBukkit - return if we don't get enough data
|
||||||
} catch (SocketTimeoutException sockettimeoutexception) {
|
} catch (SocketTimeoutException sockettimeoutexception) {
|
||||||
return; // CraftBukkit - shut down the thread after hitting an exception.
|
continue;
|
||||||
} catch (IOException ioexception) {
|
} catch (IOException ioexception) {
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
this.info("IO: " + ioexception.getMessage());
|
this.info("IO: " + ioexception.getMessage());
|
||||||
|
@ -135,6 +143,7 @@ public class RemoteControlSession extends RemoteConnectionThread {
|
||||||
if (null != this.h) {
|
if (null != this.h) {
|
||||||
try {
|
try {
|
||||||
this.h.close();
|
this.h.close();
|
||||||
|
this.info("Rcon connection closed."); // CraftBukkit
|
||||||
} catch (IOException ioexception) {
|
} catch (IOException ioexception) {
|
||||||
this.warning("IO: " + ioexception.getMessage());
|
this.warning("IO: " + ioexception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue