comment added in net.i2p.client.streaming.ConnectionHanler

This commit is contained in:
mkvore-commit
2009-04-06 07:54:19 +00:00
parent ab84a5ce8e
commit 12625a46c2

View File

@ -81,6 +81,8 @@ class ConnectionHandler {
boolean success = _synQueue.offer(packet); // fail immediately if full boolean success = _synQueue.offer(packet); // fail immediately if full
if (success) { if (success) {
SimpleScheduler.getInstance().addEvent(new TimeoutSyn(packet), _acceptTimeout); SimpleScheduler.getInstance().addEvent(new TimeoutSyn(packet), _acceptTimeout);
// advertise the new syn packet to threads that could be waiting
// (by calling waitSyn(long)
if (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) if (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE))
synchronized (this._synSignal) {this._synSignal.notifyAll();} synchronized (this._synSignal) {this._synSignal.notifyAll();}
} else { } else {
@ -103,8 +105,7 @@ class ConnectionHandler {
long now = this._context.clock().now() ; long now = this._context.clock().now() ;
long expiration = now + ms ; long expiration = now + ms ;
while ( expiration > now || ms<=0 ) { while ( expiration > now || ms<=0 ) {
// check we have not missed a SYN packet before entering // check if there is a SYN packet in the queue
// the lock
for ( Packet p : this._synQueue ) { for ( Packet p : this._synQueue ) {
if ( p.isFlagSet(Packet.FLAG_SYNCHRONIZE) ) return ; if ( p.isFlagSet(Packet.FLAG_SYNCHRONIZE) ) return ;
} }