/// <summary> /// Increase connection fails by reason. /// </summary> /// <param name="reason">Reason why connection fails.</param> /// <returns>New fails count.</returns> public uint IncFails(byte reason) { if (CKernel.ServersList.ConnectionFailed(this, reason)) { string strreason=""; switch ((Protocol.ConnectionReason)reason) { case Protocol.ConnectionReason.CannotConnect: strreason=CKernel.Globalization["SRV_DOWN"]; break; case Protocol.ConnectionReason.ClosedConnection: strreason=CKernel.Globalization["SRV_DISCONNECTED"]; break; case Protocol.ConnectionReason.NullPacket: strreason=CKernel.Globalization["SRV_FULL"]; break; case Protocol.ConnectionReason.NullID: strreason=CKernel.Globalization["SRV_FULL"]; //strreason="ID 0"; break; case Protocol.ConnectionReason.InvalidHeader: strreason=CKernel.Globalization["SRV_FULL"]; //strreason="Invalid header"; break; } CLog.Log(Constants.Log.Info,"SRV_NOTCONNECT", this.Name, strreason); if (reason==(byte)Protocol.ConnectionReason.CannotConnect) m_nFails++; } m_ServerConnection=null; m_AllFilesPublished=false; m_LastPublishedTime=DateTime.MinValue; m_LastFilePublishedIndex=0; if (m_LastSearcher!=null) m_LastSearcher.OnTCPSearchEnded(); return m_nFails; }
/// <summary> /// Connect to the server. /// </summary> public void Connect() { CLog.Log(Constants.Log.Info,"SRV_CONNECTING",this.Name); if (m_ServerConnection!=null) m_ServerConnection.CloseConnection(); m_ServerConnection=new CedonkeyServerConexion(this); m_ServerConnection.Connect(); }