3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-22 06:20:06 +01:00

Change socket traffic class try-catch. Fixes BUKKIT-2093

Dieser Commit ist enthalten in:
Wesley Wolfe 2012-08-08 06:54:28 -05:00
Ursprung 25fe93479f
Commit a16e0b6323
2 geänderte Dateien mit 4 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,7 @@ public class NetLoginHandler extends NetHandler {
private SecretKey k = null; private SecretKey k = null;
public String hostname = ""; // CraftBukkit - add field public String hostname = ""; // CraftBukkit - add field
public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) { public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException
this.server = minecraftserver; this.server = minecraftserver;
this.networkManager = new NetworkManager(socket, s, this, minecraftserver.E().getPrivate()); this.networkManager = new NetworkManager(socket, s, this, minecraftserver.E().getPrivate());
this.networkManager.e = 0; this.networkManager.e = 0;

Datei anzeigen

@ -5,6 +5,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.net.Socket; import java.net.Socket;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.SocketException;
import java.security.PrivateKey; import java.security.PrivateKey;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -46,7 +47,7 @@ public class NetworkManager implements INetworkManager {
private PrivateKey A = null; private PrivateKey A = null;
private int lowPriorityQueueDelay = 50; private int lowPriorityQueueDelay = 50;
public NetworkManager(Socket socket, String s, NetHandler nethandler, PrivateKey privatekey) { public NetworkManager(Socket socket, String s, NetHandler nethandler, PrivateKey privatekey) throws IOException { // CraftBukkit - throws IOException
this.A = privatekey; this.A = privatekey;
this.socket = socket; this.socket = socket;
this.j = socket.getRemoteSocketAddress(); this.j = socket.getRemoteSocketAddress();
@ -55,18 +56,12 @@ public class NetworkManager implements INetworkManager {
try { try {
socket.setSoTimeout(30000); socket.setSoTimeout(30000);
socket.setTrafficClass(24); socket.setTrafficClass(24);
// CraftBukkit start - initialize these in try-catch } catch (SocketException socketexception) {
this.input = new DataInputStream(socket.getInputStream());
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
} catch (IOException socketexception) {
// CraftBukkit end
System.err.println(socketexception.getMessage()); System.err.println(socketexception.getMessage());
} }
/* CraftBukkit start - moved up
this.input = new DataInputStream(socket.getInputStream()); this.input = new DataInputStream(socket.getInputStream());
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120)); this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
// CraftBukkit end */
this.u = new NetworkReaderThread(this, s + " read thread"); this.u = new NetworkReaderThread(this, s + " read thread");
this.t = new NetworkWriterThread(this, s + " write thread"); this.t = new NetworkWriterThread(this, s + " write thread");
this.u.start(); this.u.start();