* I2PTunnel: Fix timeout message on POST (ticket # )

This commit is contained in:
zzz
2011-10-19 19:09:44 +00:00
parent 892ef4abe1
commit b475e31f70
4 changed files with 10 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ public class I2PTunnelHTTPClientRunner extends I2PTunnelRunner {
*/
@Override
protected void close(OutputStream out, InputStream in, OutputStream i2pout, InputStream i2pin,
Socket s, I2PSocket i2ps, Thread t1, Thread t2) throws InterruptedException, IOException {
Socket s, I2PSocket i2ps, Thread t1, Thread t2) throws InterruptedException {
try {
i2pin.close();
} catch (IOException ioe) {

View File

@@ -143,6 +143,7 @@ public class I2PTunnelRunner extends I2PAppThread implements I2PSocket.SocketErr
InputStream i2pin = i2ps.getInputStream();
OutputStream i2pout = i2ps.getOutputStream(); //new BufferedOutputStream(i2ps.getOutputStream(), MAX_PACKET_SIZE);
if (initialI2PData != null) {
// why synchronize this? we could be in here a LONG time for large initial data
synchronized (slock) {
// this does not increment totalSent
i2pout.write(initialI2PData);
@@ -182,8 +183,11 @@ public class I2PTunnelRunner extends I2PAppThread implements I2PSocket.SocketErr
if (_log.shouldLog(Log.DEBUG))
_log.debug("runner has a timeout job, totalReceived = " + totalReceived
+ " totalSent = " + totalSent + " job = " + onTimeout);
// should we only look at totalReceived?
if ( (totalSent <= 0) && (totalReceived <= 0) )
// Run even if totalSent > 0, as that's probably POST data.
// This will be run even if initialSocketData != null, it's the timeout job's
// responsibility to know that and decide whether or not to write to the socket.
// HTTPClient never sets initialSocketData.
if (totalReceived <= 0)
onTimeout.run();
}
@@ -234,7 +238,7 @@ public class I2PTunnelRunner extends I2PAppThread implements I2PSocket.SocketErr
}
protected void close(OutputStream out, InputStream in, OutputStream i2pout, InputStream i2pin,
Socket s, I2PSocket i2ps, Thread t1, Thread t2) throws InterruptedException, IOException {
Socket s, I2PSocket i2ps, Thread t1, Thread t2) throws InterruptedException {
try {
out.flush();
} catch (IOException ioe) {