From 3114e1e802ccc9084f747c7df58ea96a6fcc883a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 23 Dec 2012 13:57:39 +1100 Subject: [PATCH] Buffer all the streams. @phanaticD please try this build as soon as you can, without your changes. --- src/main/java/net/md_5/bungee/InitialHandler.java | 3 ++- src/main/java/net/md_5/bungee/ServerConnection.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/md_5/bungee/InitialHandler.java b/src/main/java/net/md_5/bungee/InitialHandler.java index 50c56f30..4c5b7a60 100644 --- a/src/main/java/net/md_5/bungee/InitialHandler.java +++ b/src/main/java/net/md_5/bungee/InitialHandler.java @@ -1,5 +1,6 @@ package net.md_5.bungee; +import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; @@ -67,7 +68,7 @@ public class InitialHandler implements Runnable out.write(new PacketFCEncryptionResponse().getPacket()); in = new PacketInputStream(new CipherInputStream(socket.getInputStream(), EncryptionUtil.getCipher(false, shared))); - out = new CipherOutputStream(socket.getOutputStream(), EncryptionUtil.getCipher(true, shared)); + out = new CipherOutputStream(new BufferedOutputStream(socket.getOutputStream()), EncryptionUtil.getCipher(true, shared)); List customPackets = new ArrayList<>(); byte[] custom; while (Util.getId((custom = in.readPacket())) != 0xCD) diff --git a/src/main/java/net/md_5/bungee/ServerConnection.java b/src/main/java/net/md_5/bungee/ServerConnection.java index 2af817ed..e20e0cde 100644 --- a/src/main/java/net/md_5/bungee/ServerConnection.java +++ b/src/main/java/net/md_5/bungee/ServerConnection.java @@ -1,5 +1,6 @@ package net.md_5.bungee; +import java.io.BufferedOutputStream; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; @@ -65,6 +66,8 @@ public class ServerConnection extends GenericConnection out.write(new PacketFAPluginMessage("REGISTER", channel.getBytes()).getPacket()); } + out = new BufferedOutputStream(out); + return new ServerConnection(name, socket, in, out, login); } catch (KickException ex) {