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
if (success) {
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))
synchronized (this._synSignal) {this._synSignal.notifyAll();}
} else {
@ -103,8 +105,7 @@ class ConnectionHandler {
long now = this._context.clock().now() ;
long expiration = now + ms ;
while ( expiration > now || ms<=0 ) {
// check we have not missed a SYN packet before entering
// the lock
// check if there is a SYN packet in the queue
for ( Packet p : this._synQueue ) {
if ( p.isFlagSet(Packet.FLAG_SYNCHRONIZE) ) return ;
}