// check content length, 0 for content not here , > 0 content here
// int contentLength = -1;
Number160 contentKey = message.key(2);
SimpleBloomFilter<Number160> keyBloomFilter = message.bloomFilter(0);
SimpleBloomFilter<Number160> contentBloomFilter = message.bloomFilter(1);
KeyCollection keyCollection = message.keyCollection(0);
// it is important to set an integer if a value is present
boolean isDigest = message.type() != Type.REQUEST_1;
if (isDigest) {
if (message.type() == Type.REQUEST_2) {
final DigestInfo digestInfo;
if (peerBean().digestStorage() == null) {
//no storage to search
digestInfo = new DigestInfo();
}
else if (contentKey != null && locationKey!=null && domainKey!=null) {
Number320 locationAndDomainKey = new Number320(locationKey, domainKey);
Number640 from = new Number640(locationAndDomainKey, contentKey, Number160.ZERO);
Number640 to = new Number640(locationAndDomainKey, contentKey, Number160.MAX_VALUE);
digestInfo = peerBean().digestStorage().digest(from, to, -1, true);
} else if ((keyBloomFilter != null || contentBloomFilter != null) && locationKey!=null && domainKey!=null) {
Number320 locationAndDomainKey = new Number320(locationKey, domainKey);
digestInfo = peerBean().digestStorage().digest(locationAndDomainKey, keyBloomFilter,
contentBloomFilter, -1, true, true);
} else if (keyCollection!=null && keyCollection.keys().size() == 2) {
Iterator<Number640> iterator = keyCollection.keys().iterator();
Number640 from = iterator.next();
Number640 to = iterator.next();
digestInfo = peerBean().digestStorage().digest(from, to, -1, true);
} else if (locationKey!=null && domainKey!=null){
Number320 locationAndDomainKey = new Number320(locationKey, domainKey);