*) Adding peername to logmessage when receiving URLs

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@781 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 90f02ea455
commit c42a543bc3

@ -80,6 +80,9 @@ public class transferRWI {
String result = ""; String result = "";
String unknownURLs = ""; String unknownURLs = "";
yacySeed otherPeer = yacyCore.seedDB.get(iam);
String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));
if (granted) { if (granted) {
// decode request // decode request
Vector v = new Vector(); Vector v = new Vector();
@ -124,8 +127,6 @@ public class transferRWI {
Iterator it = unknownURL.iterator(); Iterator it = unknownURL.iterator();
while (it.hasNext()) unknownURLs += "," + (String) it.next(); while (it.hasNext()) unknownURLs += "," + (String) it.next();
if (unknownURLs.length() > 0) unknownURLs = unknownURLs.substring(1); if (unknownURLs.length() > 0) unknownURLs = unknownURLs.substring(1);
yacySeed otherPeer = yacyCore.seedDB.get(iam);
String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));
if (wordhashes.length == 0) if (wordhashes.length == 0)
switchboard.getLog().logInfo("Received 0 RWIs from " + otherPeerName + ", requested " + unknownURL.size() + " URLs"); switchboard.getLog().logInfo("Received 0 RWIs from " + otherPeerName + ", requested " + unknownURL.size() + " URLs");
else { else {
@ -134,6 +135,7 @@ public class transferRWI {
} }
result = "ok"; result = "ok";
} else { } else {
switchboard.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted.");
result = "error_not_granted"; result = "error_not_granted";
} }

@ -53,6 +53,7 @@ import de.anomic.plasma.plasmaCrawlLURL;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacySeed;
public class transferURL { public class transferURL {
@ -75,6 +76,9 @@ public class transferURL {
String result = ""; String result = "";
String doublevalues = "0"; String doublevalues = "0";
yacySeed otherPeer = yacyCore.seedDB.get(iam);
String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));
if (granted) { if (granted) {
int received = 0; int received = 0;
int sizeBefore = switchboard.urlPool.loadedURL.size(); int sizeBefore = switchboard.urlPool.loadedURL.size();
@ -84,18 +88,18 @@ public class transferURL {
for (int i = 0; i < urlc; i++) { for (int i = 0; i < urlc; i++) {
urls = (String) post.get("url" + i); urls = (String) post.get("url" + i);
if (urls == null) { if (urls == null) {
yacyCore.log.logFine("transferURL: got null URL-string from peer " + iam); yacyCore.log.logFine("transferURL: got null URL-string from peer " + otherPeerName);
} else { } else {
lEntry = switchboard.urlPool.loadedURL.newEntry(urls, true); lEntry = switchboard.urlPool.loadedURL.newEntry(urls, true);
if ((lEntry != null) && (blockBlacklist)) { if ((lEntry != null) && (blockBlacklist)) {
if (switchboard.urlBlacklist.isListed(lEntry.url().getHost().toLowerCase(), lEntry.url().getPath())) { if (switchboard.urlBlacklist.isListed(lEntry.url().getHost().toLowerCase(), lEntry.url().getPath())) {
yacyCore.log.logFine("transferURL: blocked blacklisted URL '" + lEntry.url() + "' from peer " + iam); yacyCore.log.logFine("transferURL: blocked blacklisted URL '" + lEntry.url() + "' from peer " + otherPeerName);
lEntry = null; lEntry = null;
} }
} }
if (lEntry != null) { if (lEntry != null) {
switchboard.urlPool.loadedURL.addEntry(lEntry, iam, iam, 3); switchboard.urlPool.loadedURL.addEntry(lEntry, iam, iam, 3);
yacyCore.log.logFine("transferURL: received URL '" + lEntry.url() + "' from peer " + iam); yacyCore.log.logFine("transferURL: received URL '" + lEntry.url() + "' from peer " + otherPeerName);
received++; received++;
} }
} }
@ -106,10 +110,11 @@ public class transferURL {
// return rewrite properties // return rewrite properties
int more = switchboard.urlPool.loadedURL.size() - sizeBefore; int more = switchboard.urlPool.loadedURL.size() - sizeBefore;
doublevalues = Integer.toString(received - more); doublevalues = Integer.toString(received - more);
switchboard.getLog().logInfo("Received " + received + " URLs from peer " + iam); switchboard.getLog().logInfo("Received " + received + " URLs from peer " + otherPeerName);
if ((received - more) > 0) switchboard.getLog().logSevere("Received " + doublevalues + " double URLs from peer " + iam); if ((received - more) > 0) switchboard.getLog().logSevere("Received " + doublevalues + " double URLs from peer " + otherPeerName);
result = "ok"; result = "ok";
} else { } else {
switchboard.getLog().logInfo("Rejecting URLs from peer " + otherPeerName + ". Not granted.");
result = "error_not_granted"; result = "error_not_granted";
} }

Loading…
Cancel
Save