(zzz)
* i2psnark: Add some synchronization to prevent rare problem after restoring orphan piece
This commit is contained in:
@ -523,22 +523,25 @@ class PeerState
|
||||
// Check for adopting an orphaned partial piece
|
||||
Request r = listener.getPeerPartial(bitfield);
|
||||
if (r != null) {
|
||||
// Check that r not already in outstandingRequests
|
||||
int[] arr = getRequestedPieces();
|
||||
boolean found = false;
|
||||
for (int i = 0; arr[i] >= 0; i++) {
|
||||
if (arr[i] == r.piece) {
|
||||
found = true;
|
||||
break;
|
||||
synchronized(this)
|
||||
{
|
||||
// Check that r not already in outstandingRequests
|
||||
int[] arr = getRequestedPieces();
|
||||
boolean found = false;
|
||||
for (int i = 0; arr[i] >= 0; i++) {
|
||||
if (arr[i] == r.piece) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
outstandingRequests.add(r);
|
||||
if (!choked)
|
||||
out.sendRequest(r);
|
||||
lastRequest = r;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
outstandingRequests.add(r);
|
||||
if (!choked)
|
||||
out.sendRequest(r);
|
||||
lastRequest = r;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
int nextPiece = listener.wantPiece(peer, bitfield);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
|
@ -1,4 +1,8 @@
|
||||
$Id: history.txt,v 1.522 2006-09-16 16:07:30 zzz Exp $
|
||||
$Id: history.txt,v 1.523 2006-09-20 17:39:26 zzz Exp $
|
||||
|
||||
2006-09-24 zzz
|
||||
* i2psnark: Add some synchronization to prevent rare problem
|
||||
after restoring orphan piece
|
||||
|
||||
2006-09-20 zzz
|
||||
* i2psnark: Eliminate duplicate requests caused by i2p-bt's
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.459 $ $Date: 2006-09-16 16:07:28 $";
|
||||
public final static String ID = "$Revision: 1.460 $ $Date: 2006-09-20 17:39:24 $";
|
||||
public final static String VERSION = "0.6.1.25";
|
||||
public final static long BUILD = 6;
|
||||
public final static long BUILD = 7;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
Reference in New Issue
Block a user