Ejemplo n.º 1
0
        private static void InitializeKademlia()
        {
            ID id = new ID(peerID);

            if (File.Exists(DHT_FILENAME))
            {
                dht = Dht.Load(File.ReadAllText(DHT_FILENAME));
                ((DBreezeStore)dht.OriginatorStorage).Open(fnLocalStore);
                ((DBreezeStore)dht.RepublishStorage).Open(fnRepublishStore);
                localStore       = dht.OriginatorStorage;
                republishStore   = dht.RepublishStorage;
                cacheStore       = new VirtualStorage();
                dht.CacheStorage = cacheStore;
                dht.FinishLoad();
            }
            else
            {
                localStore     = new DBreezeStore(fnLocalStore);
                republishStore = new DBreezeStore(fnRepublishStore);
                cacheStore     = new VirtualStorage();
                dht            = new Dht(id, new TcpProtocol(url, port), new ParallelRouter(), localStore, republishStore, cacheStore);
            }
        }