forked from I2P_Developers/i2p.i2p
UPnP: Remove finalize() in HTTPSocket (ticket #2490)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
2019-05-02 zzz
|
||||
* GeoIP Maxmind 2019-04-29
|
||||
* NTCP: Rare EventPumper 100% CPU fix (ticket #2476)
|
||||
* UPnP: Remove finalize() in HTTPSocket (ticket #2490)
|
||||
|
||||
2019-04-25 zzz
|
||||
* Build: Drop unmaintained sample apparmor script (ticket #2319)
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 10;
|
||||
public final static long BUILD = 11;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "-rc";
|
||||
|
@ -40,15 +40,18 @@ public class HTTPServerThread extends Thread
|
||||
public void run()
|
||||
{
|
||||
HTTPSocket httpSock = new HTTPSocket(sock);
|
||||
if (httpSock.open() == false)
|
||||
return;
|
||||
HTTPRequest httpReq = new HTTPRequest();
|
||||
httpReq.setSocket(httpSock);
|
||||
while (httpReq.read() == true) {
|
||||
httpServer.performRequestListener(httpReq);
|
||||
if (httpReq.isKeepAlive() == false)
|
||||
break;
|
||||
try {
|
||||
if (httpSock.open() == false)
|
||||
return;
|
||||
HTTPRequest httpReq = new HTTPRequest();
|
||||
httpReq.setSocket(httpSock);
|
||||
while (httpReq.read() == true) {
|
||||
httpServer.performRequestListener(httpReq);
|
||||
if (httpReq.isKeepAlive() == false)
|
||||
break;
|
||||
}
|
||||
} finally {
|
||||
httpSock.close();
|
||||
}
|
||||
httpSock.close();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
package org.cybergarage.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
@ -51,11 +52,6 @@ public class HTTPSocket
|
||||
setOutputStream(socket.getOutputStream());
|
||||
}
|
||||
|
||||
public void finalize()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// Socket
|
||||
////////////////////////////////////////////////
|
||||
@ -133,17 +129,18 @@ public class HTTPSocket
|
||||
|
||||
public boolean close()
|
||||
{
|
||||
try {
|
||||
if (sockIn != null)
|
||||
if (sockIn != null)
|
||||
try {
|
||||
sockIn.close();
|
||||
if (sockOut != null)
|
||||
} catch (IOException e) {}
|
||||
if (sockOut != null)
|
||||
try {
|
||||
sockOut.close();
|
||||
getSocket().close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
//Debug.warning(e);
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {}
|
||||
if (socket != null)
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException e) {}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user