*) Bugfix for "wrong seed-upload timestamp" problem

http://www.yacy-forum.de/viewtopic.php?t=817

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@480 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 34f449e6f1
commit 228b04b499

@ -346,7 +346,7 @@ public class SettingsAck_p {
if (post.containsKey("seedUploadRetry")) {
String error;
if ((error = yacyCore.saveSeedList(env)) == null) {
if ((error = ((plasmaSwitchboard)env).yc.saveSeedList(env)) == null) {
// trying to upload the seed-list file
prop.put("info", 13);
prop.put("info_success",1);
@ -377,7 +377,7 @@ public class SettingsAck_p {
// try an upload
String error;
if ((error = yacyCore.saveSeedList(env)) == null) {
if ((error = ((plasmaSwitchboard)env).yc.saveSeedList(env)) == null) {
// we have successfully uploaded the seed-list file
prop.put("info_seedUploadMethod",newSeedUploadMethod);
prop.put("info_seedURL",newSeedURLStr);
@ -423,7 +423,7 @@ public class SettingsAck_p {
// were changed, we now try to upload the seed list with the new settings
if (env.getConfig("seedUploadMethod","none").equalsIgnoreCase(uploaderName)) {
String error;
if ((error = yacyCore.saveSeedList(env)) == null) {;
if ((error = ((plasmaSwitchboard)env).yc.saveSeedList(env)) == null) {;
// we have successfully uploaded the seed file
prop.put("info", 13);

@ -179,7 +179,7 @@ public class Status {
prop.put("seedServer_seedFile", env.getConfig("seedFilePath",""));
}
prop.put("seedServer_lastUpload",
serverDate.intervalToString(System.currentTimeMillis()-yacyCore.lastSeedUpload_timeStamp));
serverDate.intervalToString(System.currentTimeMillis()-((plasmaSwitchboard)env).yc.lastSeedUpload_timeStamp));
} else {
prop.put("seedServer", 0);//disabled
}

@ -181,6 +181,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public plasmaParser parser;
public plasmaWordIndexClassicCacheMigration classicCache;
public long proxyLastAccess;
public yacyCore yc;
private serverSemaphore shutdownSync = new serverSemaphore(0);
private boolean terminate = false;
@ -342,7 +343,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// start yacy core
log.logSystem("Starting YaCy Protocol Core");
//try{Thread.currentThread().sleep(5000);} catch (InterruptedException e) {} // for profiler
yacyCore yc = new yacyCore(this);
this.yc = new yacyCore(this);
//log.logSystem("Started YaCy Protocol Core");
//System.gc(); try{Thread.currentThread().sleep(5000);} catch (InterruptedException e) {} // for profiler
serverInstantThread.oneTimeJob(yc, "loadSeeds", yc.log, 3000);

@ -98,7 +98,7 @@ public class yacyCore {
// class variables
private int lastSeedUpload_seedDBSize = 0;
public static long lastSeedUpload_timeStamp = System.currentTimeMillis();
public long lastSeedUpload_timeStamp = System.currentTimeMillis();
private String lastSeedUpload_myPeerType = "";
private String lastSeedUpload_myIP = "";
@ -238,7 +238,7 @@ public class yacyCore {
(this.lastSeedUpload_myIP.equals(seedDB.mySeed.get("IP", "127.0.0.1"))) &&
(this.lastSeedUpload_seedDBSize == seedDB.sizeConnected()) &&
(canReachMyself()) &&
(System.currentTimeMillis() - yacyCore.lastSeedUpload_timeStamp < 1000*60*60*24) &&
(System.currentTimeMillis() - this.lastSeedUpload_timeStamp < 1000*60*60*24) &&
(seedDB.mySeed.isPrincipal())
) {
log.logDebug("yacyCore.publishSeedList: not necessary to publish: oldIP is equal, sizeConnected is equal and I can reach myself under the old IP.");
@ -261,13 +261,6 @@ public class yacyCore {
}
// we want to be a principal...
saveSeedList();
this.lastSeedUpload_seedDBSize = seedDB.sizeConnected();
this.lastSeedUpload_timeStamp = System.currentTimeMillis();
this.lastSeedUpload_myIP = seedDB.mySeed.get("IP", "127.0.0.1");
this.lastSeedUpload_myPeerType = seedDB.mySeed.get("PeerType", yacySeed.PEERTYPE_JUNIOR);
} else {
if (seedUploadMethod.equals("")) this.switchboard.setConfig("seedUploadMethod","none");
log.logDebug("yacyCore.publishSeedList: No uploading method configured");
@ -629,7 +622,8 @@ public class yacyCore {
return saveSeedList(this.switchboard);
}
public static String saveSeedList(serverSwitch sb) {
public String saveSeedList(serverSwitch sb) {
try {
// return an error if this is not successful, and NULL if everything is fine
String logt;
@ -715,6 +709,13 @@ public class yacyCore {
log.logInfo(errorMsg);
return errorMsg;
}
} finally {
this.lastSeedUpload_seedDBSize = seedDB.sizeConnected();
this.lastSeedUpload_timeStamp = System.currentTimeMillis();
this.lastSeedUpload_myIP = seedDB.mySeed.get("IP", "127.0.0.1");
this.lastSeedUpload_myPeerType = seedDB.mySeed.get("PeerType", yacySeed.PEERTYPE_JUNIOR);
}
}
}

Loading…
Cancel
Save