*) Port Forwarding Feature does not detect broken connection properly.

Therefor a test-request was added to the isConnected function to detect broken connections
   and to keep open connections alive


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@596 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent af7b8f75bd
commit a812fb86cc

@ -103,11 +103,15 @@ public class hello {
if (serverCore.portForwardingEnabled) {
try {
InetAddress clientAddress = InetAddress.getByName(clientip);
InetAddress[] localAddress = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
for (int i=0; i<localAddress.length; i++) {
if (localAddress[i].equals(clientAddress)) {
isLocalIP = true;
break;
if (clientAddress.isAnyLocalAddress() || clientAddress.isLoopbackAddress()) {
isLocalIP = true;
} else {
InetAddress[] localAddress = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
for (int i=0; i<localAddress.length; i++) {
if (localAddress[i].equals(clientAddress)) {
isLocalIP = true;
break;
}
}
}
} catch (Exception e) {}

@ -8,6 +8,8 @@ import com.jcraft.jsch.UIKeyboardInteractive;
import com.jcraft.jsch.UserInfo;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacyCore;
public class serverPortForwardingSch implements serverPortForwarding{
@ -182,7 +184,9 @@ public class serverPortForwardingSch implements serverPortForwarding{
public synchronized boolean isConnected() {
if (session == null) return false;
return session.isConnected();
if (!session.isConnected()) return false;
int urls = yacyClient.queryUrlCount(yacyCore.seedDB.mySeed);
return !(urls < 0);
}
class MyUserInfo

@ -185,6 +185,8 @@ public class yacyClient {
}
}
}
} else {
yacyCore.log.logDebug("yacyClient.publishMySeed: Peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' reported us as " + mytype + ".");
}
yacyCore.seedDB.mySeed.put(yacySeed.PEERTYPE, mytype);
}

Loading…
Cancel
Save