forked from I2P_Developers/i2p.i2p
- Make short timeouts for the XML parser so we don't hang when
the UPnP device goes away - same as for HTTP POST - Stuff the port mapping requester into a thread so it doesn't delay everything for several seconds - Handle UPnP devices that return IP = 0.0.0.0 - Better HTML output when no IP found - Tweak logging - Set Disposer thread name - Keep the control point running after we find an IGD, so that we get notifications of it leaving or coming back or replaced.
This commit is contained in:
@@ -174,7 +174,7 @@ public class HTTPServer implements Runnable
|
||||
Thread.yield();
|
||||
Socket sock;
|
||||
try {
|
||||
Debug.message("accept ...");
|
||||
//Debug.message("accept ...");
|
||||
sock = accept();
|
||||
if (sock != null)
|
||||
Debug.message("sock = " + sock.getRemoteSocketAddress());
|
||||
@@ -185,7 +185,7 @@ public class HTTPServer implements Runnable
|
||||
}
|
||||
HTTPServerThread httpServThread = new HTTPServerThread(this, sock);
|
||||
httpServThread.start();
|
||||
Debug.message("httpServThread ...");
|
||||
//Debug.message("httpServThread ...");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class Disposer extends ThreadCore
|
||||
|
||||
public void run()
|
||||
{
|
||||
Thread.currentThread().setName("UPnP-Disposer");
|
||||
ControlPoint ctrlp = getControlPoint();
|
||||
long monitorInterval = ctrlp.getExpiredDeviceMonitoringInterval() * 1000;
|
||||
|
||||
|
||||
@@ -104,7 +104,8 @@ public class SSDPNotifySocket extends HTTPMUSocket implements Runnable
|
||||
InetAddress maddr = getMulticastInetAddress();
|
||||
InetAddress pmaddr = packet.getHostInetAddress();
|
||||
if (maddr.equals(pmaddr) == false) {
|
||||
Debug.warning("Invalidate Multicast Recieved : " + maddr + "," + pmaddr);
|
||||
// I2P
|
||||
//Debug.warning("Invalidate Multicast Recieved : " + maddr + "," + pmaddr);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* CyberXML for Java
|
||||
*
|
||||
* Copyright (C) Satoshi Konno 2002
|
||||
*
|
||||
*
|
||||
* File: Parser.java
|
||||
*
|
||||
* Revision;
|
||||
@@ -14,14 +14,14 @@
|
||||
* - Change parse(String) to use StringBufferInputStream instead of URL.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
|
||||
package org.cybergarage.xml;
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
|
||||
public abstract class Parser
|
||||
{
|
||||
{
|
||||
////////////////////////////////////////////////
|
||||
// Constructor
|
||||
////////////////////////////////////////////////
|
||||
@@ -44,6 +44,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");
|
||||
InputStream urlIn = urlCon.getInputStream();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user