/// <summary> /// Iteratively tries to find a list of <see cref="IContact" />s in the DHT. /// </summary> /// <param name="key"></param> /// <returns></returns> IEnumerable <IContact> INode.IterativeFindNode(string key) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException("key"); } LookupBase lookup = LookupFactory.GetLookup(this, key, true); IResult result = lookup.LookupAsync(); return(result != null ? result.Contacts : null); }
/// <summary> /// Iteratively tries to find a value in the DHT. /// </summary> /// <param name="key"></param> /// <returns></returns> IEnumerable <IContact> INode.IterativeFindValue(string key) { if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException("key"); } IResult result = (this as IKademlia).FindValue(key); if (result != null && result.Entries != null) { return(result.Entries.Select(x => x.Contact).ToList()); } LookupBase lookup = LookupFactory.GetLookup(this, key, false); result = lookup.LookupAsync(); return(result != null && result.Entries != null?result.Entries.Select(x => x.Contact).ToList() : null); }