forked from I2P_Developers/i2p.i2p
- More fixups from merge
- Remove local address from thread names for thread dump anonymity
This commit is contained in:
@@ -79,8 +79,8 @@ Public domain except as listed below:
|
||||
From freenet
|
||||
See licenses/LICENSE-GPLv2.txt
|
||||
|
||||
UPnP subsystem 1.7:
|
||||
Copyright (C) 2003-2006 Satoshi Konno
|
||||
UPnP subsystem (CyberLink) 2.1:
|
||||
Copyright (C) 2003-2010 Satoshi Konno
|
||||
See licenses/LICENSE-UPnP.txt
|
||||
|
||||
GeoIP data free to use, courtesy http://www.maxmind.com/
|
||||
|
||||
@@ -54,7 +54,9 @@ public class HTTPServer implements Runnable
|
||||
* Default timeout connection for HTTP comunication
|
||||
* @since 1.8
|
||||
*/
|
||||
public final static int DEFAULT_TIMEOUT = DEFAULT_PORT * 1000;
|
||||
// I2P fix
|
||||
//public final static int DEFAULT_TIMEOUT = DEFAULT_PORT * 1000;
|
||||
public final static int DEFAULT_TIMEOUT = 10 * 1000;
|
||||
|
||||
public static String getName()
|
||||
{
|
||||
@@ -248,7 +250,8 @@ public class HTTPServer implements Runnable
|
||||
|
||||
public boolean start(){
|
||||
StringBuffer name = new StringBuffer("Cyber.HTTPServer/");
|
||||
name.append(serverSock.getLocalSocketAddress());
|
||||
// I2P hide address from thread dumps
|
||||
//name.append(serverSock.getLocalSocketAddress());
|
||||
httpServerThread = new Thread(this,name.toString());
|
||||
httpServerThread.start();
|
||||
return true;
|
||||
|
||||
@@ -147,8 +147,9 @@ public class SSDPNotifySocket extends HTTPMUSocket implements Runnable
|
||||
String localAddr = this.getLocalAddress();
|
||||
// localAddr is null on Android m3-rc37a (01/30/08)
|
||||
if (localAddr != null && 0 < localAddr.length()) {
|
||||
name.append(this.getLocalAddress()).append(':');
|
||||
name.append(this.getLocalPort()).append(" -> ");
|
||||
// I2P hide address from thread dumps
|
||||
//name.append(this.getLocalAddress()).append(':');
|
||||
//name.append(this.getLocalPort()).append(" -> ");
|
||||
name.append(this.getMulticastAddress()).append(':');
|
||||
name.append(this.getMulticastPort());
|
||||
}
|
||||
|
||||
@@ -84,11 +84,12 @@ public class SSDPSearchResponseSocket extends HTTPUSocket implements Runnable
|
||||
StringBuffer name = new StringBuffer("Cyber.SSDPSearchResponseSocket/");
|
||||
DatagramSocket s = getDatagramSocket();
|
||||
// localAddr is null on Android m3-rc37a (01/30/08)
|
||||
InetAddress localAddr = s.getLocalAddress();
|
||||
if (localAddr != null) {
|
||||
name.append(s.getLocalAddress()).append(':');
|
||||
name.append(s.getLocalPort());
|
||||
}
|
||||
// I2P hide address from thread dumps
|
||||
//InetAddress localAddr = s.getLocalAddress();
|
||||
//if (localAddr != null) {
|
||||
// name.append(s.getLocalAddress()).append(':');
|
||||
// name.append(s.getLocalPort());
|
||||
//}
|
||||
deviceSearchResponseThread = new Thread(this,name.toString());
|
||||
deviceSearchResponseThread.start();
|
||||
}
|
||||
|
||||
@@ -174,8 +174,9 @@ public class SSDPSearchSocket extends HTTPMUSocket implements Runnable
|
||||
String localAddr = this.getLocalAddress();
|
||||
// localAddr is null on Android m3-rc37a (01/30/08)
|
||||
if (localAddr != null && 0 < localAddr.length()) {
|
||||
name.append(this.getLocalAddress()).append(':');
|
||||
name.append(this.getLocalPort()).append(" -> ");
|
||||
// I2P hide address from thread dumps
|
||||
//name.append(this.getLocalAddress()).append(':');
|
||||
//name.append(this.getLocalPort()).append(" -> ");
|
||||
name.append(this.getMulticastAddress()).append(':');
|
||||
name.append(this.getMulticastPort());
|
||||
}
|
||||
|
||||
@@ -61,6 +61,13 @@ public abstract class Parser
|
||||
|
||||
try {
|
||||
HttpURLConnection urlCon = (HttpURLConnection)locationURL.openConnection();
|
||||
// I2P mods to prevent hangs (see HTTPRequest for more info)
|
||||
// this seems to work, getInputStream actually does the connect(),
|
||||
// (as shown by a thread dump)
|
||||
// so we can set these after openConnection()
|
||||
// Alternative would be foo = new HttpURLConnection(locationURL); foo.set timeouts; foo.connect()
|
||||
urlCon.setConnectTimeout(2*1000);
|
||||
urlCon.setReadTimeout(1000);
|
||||
urlCon.setRequestMethod("GET");
|
||||
urlCon.setRequestProperty(HTTP.CONTENT_LENGTH,"0");
|
||||
if (host != null)
|
||||
|
||||
Reference in New Issue
Block a user