Exemplo n.º 1
0
        private void m_AcceptNewUpload()
        {
            if (!m_AllowNewUpload())
            {
                return;
            }

            CClient client = SelectNextClient();

            if (client != null)
            {
                client.StartUpload();
                m_LastAcceptedClientTime = DateTime.Now;
                UploadList.Add(client);
                m_QueueList.Remove(client);
                CKernel.NewUpload(client);
            }
        }
Exemplo n.º 2
0
        public void AddPartner(CClient client)
        {
            if (!AllowNewParner())
            {
                return;
            }

            //select a client and kick to allow slot for a partner
            m_AddingPartner = true;
            CClient kickClient;

            if ((UploadList.Count >= this.m_GetNumberOfSlots()))
            {
                for (int i = 0; i < UploadList.Count; i++)
                {
                    kickClient = (CClient)UploadList[i];
                    if (!kickClient.IsPartner)
                    {
                        kickClient.CancelUploadTransfer(true);
                        CLog.Log(Constants.Log.Verbose, "kicked " + kickClient.UserName + " to allow new partner");
                        break;
                    }
                }
            }

            if (client != null)
            {
                client.IsPartner = true;
                m_Partners++;
                client.StartUpload();
                m_LastAcceptedClientTime = DateTime.Now;
                UploadList.Add(client);
                m_QueueList.Remove(client);
                CKernel.NewUpload(client);
            }
            m_AddingPartner = false;
        }