Пример #1
0
 /// <summary>
 /// Read a list of servers from an incomming packet.
 /// </summary>
 /// <param name="packet">Incomming packet.</param>
 public void ProcessServerList(byte[] packet)
 {
     if (!CKernel.Preferences.GetBool("UpdateServerListFromServer")) return;
     CServerServerList DonkeyServidorListaServidores=new CServerServerList(new MemoryStream(packet),CKernel.ServersList);
     CLog.Log(Constants.Log.Info,"SRV_RECEIVED",DonkeyServidorListaServidores.NewServers);
 }
Пример #2
0
 /// <summary>
 /// Check the connection state of the server
 /// </summary>
 /// <returns>ConnectionReady returns true if the connection is established.</returns>
 public bool ConnectionReady()
 {
     m_DisconectedByUser=false;  //reset the flag
     if (CKernel.ServersList.ActiveServer!=null)
     {
     if (m_ServerConnection!=null)
     {
         m_UserID=0;
         m_ServerConnection.CloseConnection();
     }
     return false;
     }
     else
     {
     CLog.Log(Constants.Log.Info, "SRV_CONNECTED", this.Name);
     CKernel.ServersList.ActiveServer=this;
     m_LastFilePublishedIndex=0;
     PublishSharedFiles();
     MemoryStream buffer=new MemoryStream();
     CServerServerList ListaServidores=new CServerServerList(buffer);
     if (m_ServerConnection!=null) m_ServerConnection.SendPacket(buffer);
     CKernel.ServersList.NextTCPSourcesSearch=DateTime.Now+new TimeSpan(0,0,5);
     return true;
     }
 }