fix local server-client disallowing connections
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-15 18:42:29 -04:00
parent 37db40dc22
commit 8bf1c23704
6 changed files with 12 additions and 8 deletions

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file #maven.buildNumber.plugin properties file
#Tue Aug 13 19:04:49 EDT 2024 #Thu Aug 15 18:38:57 EDT 2024
buildNumber=202 buildNumber=204

View File

@ -44,7 +44,7 @@ public class DebugSPWorldLoading {
//initialize the local connection //initialize the local connection
Globals.clientUsername = "testuser"; Globals.clientUsername = "testuser";
Globals.clientPassword = AuthenticationManager.getHashedString("testpass"); Globals.clientPassword = AuthenticationManager.getHashedString("testpass");
ServerConnectionHandler serverPlayerConnection = LoadingUtils.initLocalConnection(); ServerConnectionHandler serverPlayerConnection = LoadingUtils.initLocalConnection(true);
//wait for player object creation //wait for player object creation
while(Globals.playerManager.getPlayers().size() < 1){ while(Globals.playerManager.getPlayers().size() < 1){
try { try {

View File

@ -72,7 +72,7 @@ public class LevelEditorLoading {
//initialize the local connection //initialize the local connection
Globals.clientUsername = "leveleditor"; Globals.clientUsername = "leveleditor";
Globals.clientPassword = AuthenticationManager.getHashedString("leveleditor"); Globals.clientPassword = AuthenticationManager.getHashedString("leveleditor");
ServerConnectionHandler serverPlayerConnection = LoadingUtils.initLocalConnection(); ServerConnectionHandler serverPlayerConnection = LoadingUtils.initLocalConnection(false);
//wait for player object creation //wait for player object creation
while(Globals.playerManager.getPlayers().size() < 1){ while(Globals.playerManager.getPlayers().size() < 1){
try { try {

View File

@ -42,7 +42,7 @@ public class LevelLoading {
//initialize the local connection //initialize the local connection
Globals.clientUsername = "leveleditor"; Globals.clientUsername = "leveleditor";
Globals.clientPassword = AuthenticationManager.getHashedString("leveleditor"); Globals.clientPassword = AuthenticationManager.getHashedString("leveleditor");
ServerConnectionHandler serverPlayerConnection = LoadingUtils.initLocalConnection(); ServerConnectionHandler serverPlayerConnection = LoadingUtils.initLocalConnection(true);
//wait for player object creation //wait for player object creation
while(Globals.playerManager.getPlayers().size() < 1){ while(Globals.playerManager.getPlayers().size() < 1){
try { try {

View File

@ -87,10 +87,14 @@ public class LoadingUtils {
} }
static final int STREAM_BUFFER_SIZE = 32 * 1024 * 1024; static final int STREAM_BUFFER_SIZE = 32 * 1024 * 1024;
static ServerConnectionHandler initLocalConnection(){ static ServerConnectionHandler initLocalConnection(boolean runServerThread){
ServerConnectionHandler rVal = null; ServerConnectionHandler rVal = null;
try { try {
Globals.server = new Server(NetUtils.getPort()); if(runServerThread){
LoadingUtils.initServerThread();
} else {
Globals.server = new Server(NetUtils.getPort());
}
//client -> server pipe //client -> server pipe
PipedInputStream clientInput = new PipedInputStream(STREAM_BUFFER_SIZE); PipedInputStream clientInput = new PipedInputStream(STREAM_BUFFER_SIZE);
PipedOutputStream serverOutput = new PipedOutputStream(clientInput); PipedOutputStream serverOutput = new PipedOutputStream(clientInput);

View File

@ -129,7 +129,7 @@ public class ClientNetworking implements Runnable {
this.socket = new Socket(address,port); this.socket = new Socket(address,port);
connected = true; connected = true;
} catch (IOException ex) { } catch (IOException ex) {
LoggerInterface.loggerNetworking.WARNING("Client failed to connect!"); LoggerInterface.loggerNetworking.ERROR("Client failed to connect!", ex);
} }
if(!connected){ if(!connected){
try { try {