/// <summary>
 /// Annouces Peer to DHT.
 /// </summary>
 public void AnnouncePeer(byte[] infoHash, PeerEntry peer)
 {
     // Firing DHT Put
     byte[] peer_bytes = peer.SerializeTo();
     byte[] dictKey    = ServiceUtil.GetUrlCompatibleBytes(infoHash);
     try {
         _dictSvc.Put(dictKey, peer_bytes);
     } catch (Exception ex) {
         Logger.WriteLineIf(LogLevel.Error, _log_props,
                            string.Format("Unable to announce peer to DHT. We can try next time. \n{0}", ex));
         return;
     }
     Logger.WriteLineIf(LogLevel.Info, _log_props,
                        string.Format("Successfully announced peer to DHT"));
 }
Example #2
0
        public void Put(string nameSpace, string name, byte[] value)
        {
            var keyStr = ServiceUtil.GetDictKeyBytes(nameSpace, name);

            _dict.Put(keyStr, value);
        }