mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-02-16 20:41:57 +01:00
Add a connection-timeout as this might resolve cases where the webserver is hanging for a long time
This commit is contained in:
parent
1a2d3a6d38
commit
1771768afe
@ -28,10 +28,7 @@
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
@DebugDump
|
||||
@ -73,7 +70,7 @@ public synchronized void start() {
|
||||
|
||||
try {
|
||||
server = new ServerSocket(port, maxConnections, bindAddress);
|
||||
server.setSoTimeout(0);
|
||||
server.setSoTimeout(1000);
|
||||
} catch (IOException e){
|
||||
Logger.global.logError("Error while starting the WebServer!", e);
|
||||
return;
|
||||
@ -101,7 +98,9 @@ public void run(){
|
||||
Logger.global.logWarning("Dropped an incoming HttpConnection! (Too many connections?)");
|
||||
}
|
||||
|
||||
} catch (SocketException e){
|
||||
} catch (SocketTimeoutException ignore) {
|
||||
// will be thrown regularly if no connection is coming in
|
||||
} catch (SocketException ignore){
|
||||
// this mainly occurs if the socket got closed, so we ignore this error
|
||||
} catch (IOException e){
|
||||
Logger.global.logError("Error while creating a new HttpConnection!", e);
|
||||
|
Loading…
Reference in New Issue
Block a user