Exemplo n.º 1
0
        public bool IsDeadSource(UpDownClient pToCheck)
        {
            if (!pToCheck.HasLowID || pToCheck.ServerIP != 0)
            {
                DeadSource ds =
                    new DeadSource(pToCheck.UserIDHybrid, pToCheck.UserPort,
                                   pToCheck.ServerIP, pToCheck.KadPort);

                if (deadSources_.ContainsKey(ds))
                {
                    if (deadSources_[ds] > MpdUtilities.GetTickCount())
                    {
                        return(true);
                    }
                }
            }
            if (((pToCheck.HasValidBuddyID ||
                  pToCheck.SupportsDirectUDPCallback) &&
                 !MpdUtilities.IsNullMd4(pToCheck.UserHash)) ||
                (pToCheck.HasLowID && pToCheck.ServerIP == 0))
            {
                DeadSource ds = new DeadSource(pToCheck.UserHash);
                if (deadSources_.ContainsKey(ds))
                {
                    if (deadSources_[ds] > MpdUtilities.GetTickCount())
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 public void AddDeadSource(UpDownClient pToAdd)
 {
     if (!pToAdd.HasLowID)
     {
         DeadSource ds =
             new DeadSource(pToAdd.UserIDHybrid, pToAdd.UserPort,
                            pToAdd.ServerIP, pToAdd.KadPort);
         deadSources_[ds] = BLOCKTIME();
     }
     else
     {
         if (pToAdd.ServerIP != 0)
         {
             DeadSource ds =
                 new DeadSource(pToAdd.UserIDHybrid, pToAdd.UserPort,
                                pToAdd.ServerIP, 0);
             deadSources_[ds] = BLOCKTIMEFW();
         }
         if (pToAdd.HasValidBuddyID || pToAdd.SupportsDirectUDPCallback)
         {
             DeadSource ds = new DeadSource(pToAdd.UserHash);
             deadSources_[ds] = BLOCKTIMEFW();
         }
     }
     if (MpdUtilities.GetTickCount() - lastCleanUp_ > CLEANUPTIME)
     {
         CleanUp();
     }
 }
Exemplo n.º 3
0
 public void RemoveDeadSource(UpDownClient client)
 {
     if (!client.HasLowID)
     {
         DeadSource ds =
             new DeadSource(client.UserIDHybrid, client.UserPort,
                            client.ServerIP, client.KadPort);
         deadSources_.Remove(ds);
     }
     else
     {
         if (client.ServerIP != 0)
         {
             DeadSource ds =
                 new DeadSource(client.UserIDHybrid, client.UserPort,
                                client.ServerIP, 0);
             deadSources_.Remove(ds);
         }
         if (client.HasValidBuddyID || client.SupportsDirectUDPCallback)
         {
             DeadSource ds =
                 new DeadSource(client.UserHash);
             deadSources_.Remove(ds);
         }
     }
 }
Exemplo n.º 4
0
 public DeadSource(DeadSource ds)
 {
     id_       = ds.id_;
     serverIP_ = ds.serverIP_;
     port_     = ds.port_;
     kadPort_  = ds.kadPort_;
     MpdUtilities.Md4Cpy(hash_, ds.hash_);
 }