Number160 domainKey = message.key(1);
SimpleBloomFilter<Number160> knownPeers = message.bloomFilter(0);
PublicKey publicKey = message.publicKey(0);
//
TrackerData meshPeers = trackerStorage.peers(new Number320(locationKey, domainKey));
LOG.debug("found peers on tracker: {}", meshPeers == null ? "null " : meshPeers.peerAddresses());
boolean couldProvideMoreData = false;
if (meshPeers != null) {
if (knownPeers != null) {
meshPeers = UtilsTracker.disjunction(meshPeers, knownPeers);
}
int size = meshPeers.size();
meshPeers = UtilsTracker.limit(meshPeers, TrackerRPC.MAX_MSG_SIZE_UDP);
couldProvideMoreData = size > meshPeers.size();
responseMessage.trackerData(meshPeers);
}
if (couldProvideMoreData) {
responseMessage.type(Message.Type.PARTIALLY_OK);
}
if (message.command() == RPC.Commands.TRACKER_ADD.getNr()) {
TrackerData trackerData = message.trackerData(0);
if (trackerData.size() != 1) {
responseMessage.type(Message.Type.EXCEPTION);
} else {
Map.Entry<PeerStatistic, Data> entry = trackerData.peerAddresses().entrySet().iterator().next();
if (!trackerStorage.put(new Number320(locationKey, domainKey), entry.getKey().peerAddress(), publicKey,
entry.getValue())) {
responseMessage.type(Message.Type.DENIED);
LOG.debug("tracker NOT put on({}) locationKey:{}, domainKey:{}, address:{}", peerBean()
.serverPeerAddress(), locationKey, domainKey, entry.getKey());