// Only accept a valid message. See comments at top of NodeDispatcher, but it's a good idea anyway.
if(target < 0.0 || target >= 1.0 || htl <= 0 ||
paddedLength < 0 || paddedLength > OpennetManager.MAX_OPENNET_NODEREF_LENGTH ||
noderefLength > paddedLength) {
Message msg = DMT.createFNPRejectedOverload(uid, true, false, false);
try {
source.sendAsync(msg, null, node.nodeStats.announceByteCounter);
} catch (NotConnectedException e) {
// OK
}
if(logMINOR) Logger.minor(this, "Got bogus announcement message from "+source);
return true;
}
OpennetManager om = node.getOpennet();
if(om == null || !source.canAcceptAnnouncements()) {
if(om != null && source instanceof SeedClientPeerNode)
om.seedTracker.rejectedAnnounce((SeedClientPeerNode)source);
Message msg = DMT.createFNPOpennetDisabled(uid);
try {
source.sendAsync(msg, null, node.nodeStats.announceByteCounter);
} catch (NotConnectedException e) {
// OK
}
if(logMINOR) Logger.minor(this, "Rejected announcement (opennet or announcement disabled) from "+source);
return true;
}
boolean success = false;
try {
// UIDs for announcements are separate from those for requests.
// So we don't need to, and should not, ask Node.
if(!node.nodeStats.shouldAcceptAnnouncement(uid)) {
if(om != null && source instanceof SeedClientPeerNode)
om.seedTracker.rejectedAnnounce((SeedClientPeerNode)source);
Message msg = DMT.createFNPRejectedOverload(uid, true, false, false);
try {
source.sendAsync(msg, null, node.nodeStats.announceByteCounter);
} catch (NotConnectedException e) {
// OK
}
if(logMINOR) Logger.minor(this, "Rejected announcement (overall overload) from "+source);
return true;
}
if(!source.shouldAcceptAnnounce(uid)) {
if(om != null && source instanceof SeedClientPeerNode)
om.seedTracker.rejectedAnnounce((SeedClientPeerNode)source);
node.nodeStats.endAnnouncement(uid);
Message msg = DMT.createFNPRejectedOverload(uid, true, false, false);
try {
source.sendAsync(msg, null, node.nodeStats.announceByteCounter);
} catch (NotConnectedException e) {
// OK
}
if(logMINOR) Logger.minor(this, "Rejected announcement (peer limit) from "+source);
return true;
}
if(om != null && source instanceof SeedClientPeerNode) {
if(!om.seedTracker.acceptAnnounce((SeedClientPeerNode)source, node.fastWeakRandom)) {
node.nodeStats.endAnnouncement(uid);
Message msg = DMT.createFNPRejectedOverload(uid, true, false, false);
try {
source.sendAsync(msg, null, node.nodeStats.announceByteCounter);
} catch (NotConnectedException e) {
// OK
}