From c42a543bc3e75f2c9f88b7bb9b2864f2d99e044f Mon Sep 17 00:00:00 2001 From: theli Date: Thu, 22 Sep 2005 23:40:03 +0000 Subject: [PATCH] *) Adding peername to logmessage when receiving URLs git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@781 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/transferRWI.java | 6 ++++-- htroot/yacy/transferURL.java | 15 ++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java index d86182c67..0ecae4d5b 100644 --- a/htroot/yacy/transferRWI.java +++ b/htroot/yacy/transferRWI.java @@ -80,6 +80,9 @@ public class transferRWI { String result = ""; String unknownURLs = ""; + yacySeed otherPeer = yacyCore.seedDB.get(iam); + String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion())); + if (granted) { // decode request Vector v = new Vector(); @@ -124,8 +127,6 @@ public class transferRWI { Iterator it = unknownURL.iterator(); while (it.hasNext()) unknownURLs += "," + (String) it.next(); 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) switchboard.getLog().logInfo("Received 0 RWIs from " + otherPeerName + ", requested " + unknownURL.size() + " URLs"); else { @@ -134,6 +135,7 @@ public class transferRWI { } result = "ok"; } else { + switchboard.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted."); result = "error_not_granted"; } diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java index 2099bd7ff..5e1446b1c 100644 --- a/htroot/yacy/transferURL.java +++ b/htroot/yacy/transferURL.java @@ -53,6 +53,7 @@ import de.anomic.plasma.plasmaCrawlLURL; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.yacy.yacyCore; +import de.anomic.yacy.yacySeed; public class transferURL { @@ -75,6 +76,9 @@ public class transferURL { String result = ""; String doublevalues = "0"; + yacySeed otherPeer = yacyCore.seedDB.get(iam); + String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion())); + if (granted) { int received = 0; int sizeBefore = switchboard.urlPool.loadedURL.size(); @@ -84,18 +88,18 @@ public class transferURL { for (int i = 0; i < urlc; i++) { urls = (String) post.get("url" + i); 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 { lEntry = switchboard.urlPool.loadedURL.newEntry(urls, true); if ((lEntry != null) && (blockBlacklist)) { 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; } } if (lEntry != null) { 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++; } } @@ -106,10 +110,11 @@ public class transferURL { // return rewrite properties int more = switchboard.urlPool.loadedURL.size() - sizeBefore; doublevalues = Integer.toString(received - more); - switchboard.getLog().logInfo("Received " + received + " URLs from peer " + iam); - if ((received - more) > 0) switchboard.getLog().logSevere("Received " + doublevalues + " double 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 " + otherPeerName); result = "ok"; } else { + switchboard.getLog().logInfo("Rejecting URLs from peer " + otherPeerName + ". Not granted."); result = "error_not_granted"; }