diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-06-10 21:52:52 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-06-10 22:26:07 -0500 |
commit | 0942b1861b82e1e1c83f97ce3d0bfeaa04f15a91 (patch) | |
tree | 6bf79f2ecd4db796376e27f7675d72347c2f5cae /src/main/java | |
parent | 87600345cba64417ded0c6d30f06310466f4717d (diff) | |
download | craftbukkit-0942b1861b82e1e1c83f97ce3d0bfeaa04f15a91.tar craftbukkit-0942b1861b82e1e1c83f97ce3d0bfeaa04f15a91.tar.gz craftbukkit-0942b1861b82e1e1c83f97ce3d0bfeaa04f15a91.tar.lz craftbukkit-0942b1861b82e1e1c83f97ce3d0bfeaa04f15a91.tar.xz craftbukkit-0942b1861b82e1e1c83f97ce3d0bfeaa04f15a91.zip |
Handle rcon timeouts properly
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/RemoteControlSession.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/RemoteControlSession.java b/src/main/java/net/minecraft/server/RemoteControlSession.java index 9d4c234a..85b424e7 100644 --- a/src/main/java/net/minecraft/server/RemoteControlSession.java +++ b/src/main/java/net/minecraft/server/RemoteControlSession.java @@ -17,6 +17,13 @@ public class RemoteControlSession extends RemoteConnectionThread { RemoteControlSession(IMinecraftServer iminecraftserver, Socket socket) { super(iminecraftserver); 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.info("Rcon connection from: " + socket.getInetAddress()); } @@ -83,8 +90,9 @@ public class RemoteControlSession extends RemoteConnectionThread { continue; } } + return; // CraftBukkit - return if we don't get enough data } catch (SocketTimeoutException sockettimeoutexception) { - return; // CraftBukkit - shut down the thread after hitting an exception. + continue; } catch (IOException ioexception) { if (this.running) { this.info("IO: " + ioexception.getMessage()); @@ -135,6 +143,7 @@ public class RemoteControlSession extends RemoteConnectionThread { if (null != this.h) { try { this.h.close(); + this.info("Rcon connection closed."); // CraftBukkit } catch (IOException ioexception) { this.warning("IO: " + ioexception.getMessage()); } |