forked from I2P_Developers/i2p.i2p
fixes while rechecking storage
This commit is contained in:
@ -377,7 +377,10 @@ class PeerCoordinator implements PeerListener
|
|||||||
public boolean needOutboundPeers() {
|
public boolean needOutboundPeers() {
|
||||||
//return wantedBytes != 0 && needPeers();
|
//return wantedBytes != 0 && needPeers();
|
||||||
// minus one to make it a little easier for new peers to get in on large swarms
|
// minus one to make it a little easier for new peers to get in on large swarms
|
||||||
return wantedBytes != 0 && !halted && peers.size() < getMaxConnections() - 1;
|
return wantedBytes != 0 &&
|
||||||
|
!halted &&
|
||||||
|
peers.size() < getMaxConnections() - 1 &&
|
||||||
|
(storage == null || !storage.isChecking());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -945,6 +948,8 @@ class PeerCoordinator implements PeerListener
|
|||||||
{
|
{
|
||||||
if (metainfo == null || storage == null)
|
if (metainfo == null || storage == null)
|
||||||
return true;
|
return true;
|
||||||
|
if (storage.isChecking())
|
||||||
|
return true;
|
||||||
int piece = pp.getPiece();
|
int piece = pp.getPiece();
|
||||||
if (halted) {
|
if (halted) {
|
||||||
_log.info("Got while-halted piece " + piece + "/" + metainfo.getPieces() +" from " + peer + " for " + metainfo.getName());
|
_log.info("Got while-halted piece " + piece + "/" + metainfo.getPieces() +" from " + peer + " for " + metainfo.getName());
|
||||||
@ -968,6 +973,7 @@ class PeerCoordinator implements PeerListener
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// this takes forever if complete, as it rechecks
|
||||||
if (storage.putPiece(pp))
|
if (storage.putPiece(pp))
|
||||||
{
|
{
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
@ -1173,6 +1179,8 @@ class PeerCoordinator implements PeerListener
|
|||||||
public PartialPiece getPartialPiece(Peer peer, BitField havePieces) {
|
public PartialPiece getPartialPiece(Peer peer, BitField havePieces) {
|
||||||
if (metainfo == null)
|
if (metainfo == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (storage != null && storage.isChecking())
|
||||||
|
return null;
|
||||||
synchronized(wantedPieces) {
|
synchronized(wantedPieces) {
|
||||||
// sorts by remaining bytes, least first
|
// sorts by remaining bytes, least first
|
||||||
Collections.sort(partialPieces);
|
Collections.sort(partialPieces);
|
||||||
|
@ -982,6 +982,8 @@ public class Storage
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the piece in the Storage if it is correct.
|
* Put the piece in the Storage if it is correct.
|
||||||
|
* Warning - takes a LONG time if complete as it does the recheck here.
|
||||||
|
* TODO thread the recheck?
|
||||||
*
|
*
|
||||||
* @return true if the piece was correct (sha metainfo hash
|
* @return true if the piece was correct (sha metainfo hash
|
||||||
* matches), otherwise false.
|
* matches), otherwise false.
|
||||||
|
@ -1153,7 +1153,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
|||||||
out.write("</a>");
|
out.write("</a>");
|
||||||
|
|
||||||
out.write("<td align=\"right\" class=\"snarkTorrentETA " + rowClass + "\">");
|
out.write("<td align=\"right\" class=\"snarkTorrentETA " + rowClass + "\">");
|
||||||
if(isRunning && remainingSeconds > 0)
|
if(isRunning && remainingSeconds > 0 && !snark.isChecking())
|
||||||
out.write(DataHelper.formatDuration2(Math.max(remainingSeconds, 10) * 1000)); // (eta 6h)
|
out.write(DataHelper.formatDuration2(Math.max(remainingSeconds, 10) * 1000)); // (eta 6h)
|
||||||
out.write("</td>\n\t");
|
out.write("</td>\n\t");
|
||||||
out.write("<td align=\"right\" class=\"snarkTorrentDownloaded " + rowClass + "\">");
|
out.write("<td align=\"right\" class=\"snarkTorrentDownloaded " + rowClass + "\">");
|
||||||
|
Reference in New Issue
Block a user