Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Adding timeout to ftpc.java See: http://www.yacy-forum.de/viewtopic.php?t=2268

thelia10072b5c001
diff --git a/source/de/anomic/net/ftpc.java b/source/de/anomic/net/ftpc.java
index 30e10c9d6..da133a869 100644
--- a/source/de/anomic/net/ftpc.java
+++ b/source/de/anomic/net/ftpc.java
@@ -96,11 +96,14 @@ public class ftpc {
// client socket for commands
private Socket ControlSocket = null;
+ // socket timeout
+ private int ControlSocketTimeout = 300000;
+
// socket for data transactions
private ServerSocket DataSocketActive = null;
private Socket DataSocketPassive = null;
private boolean DataSocketPassiveMode = true;
-
+
// output and input streams for client control connection
private BufferedReader clientInput = null;
private DataOutputStream clientOutput = null;
@@ -1187,6 +1190,7 @@ cd ..
}
try {
ControlSocket = new Socket(cmd[1], port);
+ ControlSocket.setSoTimeout(this.ControlSocketTimeout);
clientInput = new BufferedReader(new InputStreamReader(ControlSocket.getInputStream()));
clientOutput = new DataOutputStream(new BufferedOutputStream(ControlSocket.getOutputStream()));
@@ -1794,6 +1798,14 @@ cd ..
if (Integer.parseInt(reply.substring(0, 1)) == 5) throw new IOException(reply);
}
+
+ public int getTimeout() {
+ return this.ControlSocketTimeout;
+ }
+
+ public void setTimeout(int timeout) {
+ this.ControlSocketTimeout = timeout;
+ }
class ee extends SecurityException {