From bc3f63790a841c1ad7b20bf5acd4dd6abe61d675 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 24 Dec 2012 11:47:25 +1100 Subject: [PATCH] Add tweakable buffer size. --- src/main/java/net/md_5/bungee/Configuration.java | 1 + src/main/java/net/md_5/bungee/InitialHandler.java | 2 +- src/main/java/net/md_5/bungee/ServerConnection.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/md_5/bungee/Configuration.java b/src/main/java/net/md_5/bungee/Configuration.java index c199cae6..e8f1f7f0 100644 --- a/src/main/java/net/md_5/bungee/Configuration.java +++ b/src/main/java/net/md_5/bungee/Configuration.java @@ -133,6 +133,7 @@ public class Configuration */ public String statsUuid = UUID.randomUUID().toString(); public boolean metricsEnabled = true; + public int bufferSize = 2048; /** * Load the configuration and save default values. diff --git a/src/main/java/net/md_5/bungee/InitialHandler.java b/src/main/java/net/md_5/bungee/InitialHandler.java index f30cb270..e5790a4d 100644 --- a/src/main/java/net/md_5/bungee/InitialHandler.java +++ b/src/main/java/net/md_5/bungee/InitialHandler.java @@ -68,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(new BufferedOutputStream(socket.getOutputStream(), 4096), EncryptionUtil.getCipher(true, shared)); + out = new CipherOutputStream(new BufferedOutputStream(socket.getOutputStream(), BungeeCord.instance.config.bufferSize), 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 b255f91a..72fc1d85 100644 --- a/src/main/java/net/md_5/bungee/ServerConnection.java +++ b/src/main/java/net/md_5/bungee/ServerConnection.java @@ -66,7 +66,7 @@ public class ServerConnection extends GenericConnection out.write(new PacketFAPluginMessage("REGISTER", channel.getBytes()).getPacket()); } - out = new BufferedOutputStream(out, 4096); + out = new BufferedOutputStream(out, BungeeCord.instance.config.bufferSize); return new ServerConnection(name, socket, in, out, login); } catch (KickException ex)