Set timeout of 3 minutes for the socket.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 5 Aug 2013 17:16:24 +0000 (19:16 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 8 Aug 2013 00:15:59 +0000 (02:15 +0200)
src/main/java/net/pterodactylus/irc/Connection.java

index f48b205..f3f41f0 100644 (file)
@@ -35,6 +35,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.net.SocketFactory;
@@ -346,6 +347,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic
                /* connect to remote socket. */
                try {
                        Socket socket = socketFactory.createSocket(hostname, port);
+                       socket.setSoTimeout((int) TimeUnit.MINUTES.toMillis(3));
                        connectionHandler = new ConnectionHandler(socket.getInputStream(), socket.getOutputStream());
 
                        /* register connection. */