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
|
From freenet
|
||||||
See licenses/LICENSE-GPLv2.txt
|
See licenses/LICENSE-GPLv2.txt
|
||||||
|
|
||||||
UPnP subsystem 1.7:
|
UPnP subsystem (CyberLink) 2.1:
|
||||||
Copyright (C) 2003-2006 Satoshi Konno
|
Copyright (C) 2003-2010 Satoshi Konno
|
||||||
See licenses/LICENSE-UPnP.txt
|
See licenses/LICENSE-UPnP.txt
|
||||||
|
|
||||||
GeoIP data free to use, courtesy http://www.maxmind.com/
|
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
|
* Default timeout connection for HTTP comunication
|
||||||
* @since 1.8
|
* @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()
|
public static String getName()
|
||||||
{
|
{
|
||||||
@@ -248,7 +250,8 @@ public class HTTPServer implements Runnable
|
|||||||
|
|
||||||
public boolean start(){
|
public boolean start(){
|
||||||
StringBuffer name = new StringBuffer("Cyber.HTTPServer/");
|
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 = new Thread(this,name.toString());
|
||||||
httpServerThread.start();
|
httpServerThread.start();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -147,8 +147,9 @@ public class SSDPNotifySocket extends HTTPMUSocket implements Runnable
|
|||||||
String localAddr = this.getLocalAddress();
|
String localAddr = this.getLocalAddress();
|
||||||
// localAddr is null on Android m3-rc37a (01/30/08)
|
// localAddr is null on Android m3-rc37a (01/30/08)
|
||||||
if (localAddr != null && 0 < localAddr.length()) {
|
if (localAddr != null && 0 < localAddr.length()) {
|
||||||
name.append(this.getLocalAddress()).append(':');
|
// I2P hide address from thread dumps
|
||||||
name.append(this.getLocalPort()).append(" -> ");
|
//name.append(this.getLocalAddress()).append(':');
|
||||||
|
//name.append(this.getLocalPort()).append(" -> ");
|
||||||
name.append(this.getMulticastAddress()).append(':');
|
name.append(this.getMulticastAddress()).append(':');
|
||||||
name.append(this.getMulticastPort());
|
name.append(this.getMulticastPort());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,11 +84,12 @@ public class SSDPSearchResponseSocket extends HTTPUSocket implements Runnable
|
|||||||
StringBuffer name = new StringBuffer("Cyber.SSDPSearchResponseSocket/");
|
StringBuffer name = new StringBuffer("Cyber.SSDPSearchResponseSocket/");
|
||||||
DatagramSocket s = getDatagramSocket();
|
DatagramSocket s = getDatagramSocket();
|
||||||
// localAddr is null on Android m3-rc37a (01/30/08)
|
// localAddr is null on Android m3-rc37a (01/30/08)
|
||||||
InetAddress localAddr = s.getLocalAddress();
|
// I2P hide address from thread dumps
|
||||||
if (localAddr != null) {
|
//InetAddress localAddr = s.getLocalAddress();
|
||||||
name.append(s.getLocalAddress()).append(':');
|
//if (localAddr != null) {
|
||||||
name.append(s.getLocalPort());
|
// name.append(s.getLocalAddress()).append(':');
|
||||||
}
|
// name.append(s.getLocalPort());
|
||||||
|
//}
|
||||||
deviceSearchResponseThread = new Thread(this,name.toString());
|
deviceSearchResponseThread = new Thread(this,name.toString());
|
||||||
deviceSearchResponseThread.start();
|
deviceSearchResponseThread.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,8 +174,9 @@ public class SSDPSearchSocket extends HTTPMUSocket implements Runnable
|
|||||||
String localAddr = this.getLocalAddress();
|
String localAddr = this.getLocalAddress();
|
||||||
// localAddr is null on Android m3-rc37a (01/30/08)
|
// localAddr is null on Android m3-rc37a (01/30/08)
|
||||||
if (localAddr != null && 0 < localAddr.length()) {
|
if (localAddr != null && 0 < localAddr.length()) {
|
||||||
name.append(this.getLocalAddress()).append(':');
|
// I2P hide address from thread dumps
|
||||||
name.append(this.getLocalPort()).append(" -> ");
|
//name.append(this.getLocalAddress()).append(':');
|
||||||
|
//name.append(this.getLocalPort()).append(" -> ");
|
||||||
name.append(this.getMulticastAddress()).append(':');
|
name.append(this.getMulticastAddress()).append(':');
|
||||||
name.append(this.getMulticastPort());
|
name.append(this.getMulticastPort());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,13 @@ public abstract class Parser
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
HttpURLConnection urlCon = (HttpURLConnection)locationURL.openConnection();
|
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.setRequestMethod("GET");
|
||||||
urlCon.setRequestProperty(HTTP.CONTENT_LENGTH,"0");
|
urlCon.setRequestProperty(HTTP.CONTENT_LENGTH,"0");
|
||||||
if (host != null)
|
if (host != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user