- 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:
zzz
2009-05-03 18:35:27 +00:00
parent c6b2492e73
commit 65a41908ec
5 changed files with 120 additions and 40 deletions

View File

@@ -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 ...");
}
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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();