public List <string> GetFingerprints(string uid) { if (_online) { return(_provider.GetFingerprints(uid)); } List <string> fingerprints = new List <string>(); DhtGetResult[] dgrs = null; string key = DHTPREFIX + uid; try { dgrs = _dht.Get(key); } catch (Exception e) { ProtocolLog.Write(SocialLog.SVPNLog, e.Message); ProtocolLog.Write(SocialLog.SVPNLog, "DHT GET FPR FAILURE: " + key); } foreach (DhtGetResult dgr in dgrs) { fingerprints.Add(dgr.valueString); } return(fingerprints); }
public void SerialGet(object data) { Hashtable ht = (Hashtable)data; byte[] key = (byte[])ht["key"]; byte[][] expected_results = (byte[][])ht["results"]; int op = (int)ht["op"]; try { Hashtable[] result = default_dht.Get(key); bool found = false; int found_count = 0; for (int i = 0; i < result.Length; i++) { for (int j = 0; j < expected_results.Length; j++) { if (ArrayComparer((byte[])result[i]["value"], expected_results[j])) { found = true; break; } } if (found) { found_count++; found = false; } } if (found_count != expected_results.Length) { lock (_lock) { Console.WriteLine("Failed get... attempted to get " + expected_results.Length + " found " + found_count + " out of " + result.Length + " returned" + " operation: " + op); } } } catch (Exception e) { Console.WriteLine("Failure at operation: " + op); Console.WriteLine(e); } }