From 48447addba3a80e5f5ba609cb3c572af092208df Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 8 Feb 2013 16:21:08 +1100 Subject: [PATCH] Hasten login process a tad, maybe a 100ms saved for the user --- proxy/src/main/java/net/md_5/bungee/InitialHandler.java | 2 +- proxy/src/main/java/net/md_5/bungee/ServerConnection.java | 7 +------ proxy/src/main/java/net/md_5/bungee/UserConnection.java | 7 ++----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/InitialHandler.java index 701d4b7d..41beef4b 100644 --- a/proxy/src/main/java/net/md_5/bungee/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/InitialHandler.java @@ -130,7 +130,7 @@ public class InitialHandler extends PacketHandler implements Runnable, PendingCo { Preconditions.checkState(thisState == State.LOGIN); - UserConnection userCon = new UserConnection(socket, this, in, out, handshake, new ArrayList()); + UserConnection userCon = new UserConnection(socket, this, in, out, handshake); String server = ProxyServer.getInstance().getReconnectHandler().getServer(userCon); ServerInfo s = BungeeCord.getInstance().config.getServers().get(server); userCon.connect(s); diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java index 865aa44b..25c4748f 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java @@ -52,14 +52,9 @@ public class ServerConnection extends GenericConnection implements Server OutputStream out = socket.getOutputStream(); out.write(handshake.getPacket()); + out.write(new PacketCDClientStatus((byte) 0).getPacket()); in.readPacket(); - for (byte[] custom : user.loginPackets) - { - out.write(custom); - } - - out.write(new PacketCDClientStatus((byte) 0).getPacket()); byte[] loginResponse = in.readPacket(); if (Util.getId(loginResponse) == 0xFF) { diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index bb06ea30..6a8b4dd7 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -8,7 +8,6 @@ import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -23,7 +22,6 @@ import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.ChatEvent; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.event.ServerConnectEvent; @@ -34,7 +32,6 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer public final Packet2Handshake handshake; public Queue packetQueue = new ConcurrentLinkedQueue<>(); - public List loginPackets = new ArrayList<>(); @Getter private final PendingConnection pendingConnection; @Getter @@ -55,14 +52,14 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer private final Map permissions = new HashMap<>(); private final Object permMutex = new Object(); - public UserConnection(Socket socket, PendingConnection pendingConnection, PacketInputStream in, OutputStream out, Packet2Handshake handshake, List loginPackets) + public UserConnection(Socket socket, PendingConnection pendingConnection, PacketInputStream in, OutputStream out, Packet2Handshake handshake) { super(socket, in, out); this.handshake = handshake; this.pendingConnection = pendingConnection; name = handshake.username; displayName = handshake.username; - this.loginPackets = loginPackets; + Collection g = ProxyServer.getInstance().getConfigurationAdapter().getGroups(name); for (String s : g) {