2007-11-26 zzz

* i2psnark: add timeout for receive inactivity
This commit is contained in:
zzz
2007-11-26 21:53:58 +00:00
committed by zzz
parent 4ebcc95d9f
commit c6a1112f0a
5 changed files with 18 additions and 9 deletions

View File

@ -35,10 +35,13 @@ class PeerConnectionIn implements Runnable
private Thread thread;
private volatile boolean quit;
long lastRcvd;
public PeerConnectionIn(Peer peer, DataInputStream din)
{
this.peer = peer;
this.din = din;
lastRcvd = System.currentTimeMillis();
quit = false;
}
@ -76,6 +79,7 @@ class PeerConnectionIn implements Runnable
// Wait till we hear something...
// The length of a complete message in bytes.
int i = din.readInt();
lastRcvd = System.currentTimeMillis();
if (i < 0)
throw new IOException("Unexpected length prefix: " + i);