/// <summary>
 /// 对象池信息
 /// </summary>
 private void OnCommand_Pools(string[] param)
 {
     NetChannelPools.ToString(true);
     UserTokenPools.ToString(true);
     IOCPClientSocket.ToString(true);
     IOCPServerSocket.ToString(true);
     SendRecvBufferPools.ToString(true);
     PacketPools.ToString(true);
     ObjectPools.ToString(true);
     CommonObjectPools.ToString(true);
 }
Exemple #2
0
 /// <summary>
 /// 对象池信息
 /// </summary>
 private void OnCommand_Pools(string[] param)
 {
     NetChannelPools.ToString(true);
     UserTokenPools.ToString(true);
     IOCPClientSocket.ToString(true);
     IOCPServerSocket.ToString(true);
     SendRecvBufferPools.ToString(true);
     PacketPools.ToString(true);
     ObjectPools.ToString(true);
     CommonObjectPools.ToString(true);
     Console.WriteLine("缓存账号数量:" + AccountCacheManager.Instance.GetCacheCount());
 }
        private void OnAcceptConnect(long conn_idx)
        {
            lock (ThreadScheduler.Instance.LogicLock)
            {
                m_channel = NetChannelPools.Spawn();
                m_channel.Setup(this, m_conn_idx);

                if (OnConnected != null)
                {
                    OnConnected(m_channel.conn_idx);
                }
            }
        }
 /// <summary>
 /// 关闭链接:底层通知
 /// </summary>
 private void HanldeCloseConnect()
 {
     if (m_channel != null)
     {
         m_channel.Destroy();
         NetChannelPools.Despawn(m_channel);
         m_channel = null;
     }
     if (OnClose != null)
     {
         OnClose(conn_idx);
         OnClose = null;
     }
 }
Exemple #5
0
        private void OnAcceptConnect(long conn_idx)
        {
            lock (ThreadScheduler.Instance.LogicLock)
            {
                NetChannel channel = NetChannelPools.Spawn();
                channel.Setup(this, conn_idx);
                m_channels.Add(channel.conn_idx, channel);

                if (OnAccept != null)
                {
                    OnAccept(conn_idx);
                }
            }
        }
 public override void Destroy()
 {
     if (m_socket != null)
     {//socket只有外部调用时才主动关闭,否则底层会先自己关闭
         m_socket.Close();
         m_socket = null;
     }
     if (m_channel != null)
     {
         m_channel.Destroy();
         NetChannelPools.Despawn(m_channel);
         m_channel = null;
     }
     base.Destroy();
 }
Exemple #7
0
        /// <summary>
        /// 关闭链接:底层通知
        /// </summary>
        private void HanldeCloseConnect(long conn_idx)
        {
            NetChannel channel;

            if (m_channels.TryGetValue(conn_idx, out channel))
            {
                channel.Destroy();
                NetChannelPools.Despawn(channel);
            }
            m_channels.Remove(conn_idx);
            if (OnClose != null)
            {
                OnClose(conn_idx);
            }
        }
Exemple #8
0
        /// <summary>
        /// 对象池信息
        /// </summary>
        private void OnCommand_Pools(string[] param)
        {
            NetChannelPools.ToString(true);
            UserTokenPools.ToString(true);
            IOCPClientSocket.ToString(true);
            IOCPServerSocket.ToString(true);
            SendRecvBufferPools.ToString(true);
            PacketPools.ToString(true);
            ObjectPools.ToString(true);
            CommonObjectPools.ToString(true);

            int unit_count     = UnitManager.Instance.GetUnitCount();
            int relation_count = RelationManager.Instance.GetMemberCount();

            Console.WriteLine("缓存玩家数量:" + unit_count + " 缓存关系数量:" + relation_count);
        }
Exemple #9
0
 public override void Close()
 {
     if (m_socket != null)
     {
         m_socket.Close();
         m_socket = null;
     }
     //需要放m_socket.Close()后,socket关闭时,内部回调的关闭事件HanldeCloseConnect不能正常执行
     foreach (var obj in m_channels)
     {
         obj.Value.Destroy();
         NetChannelPools.Despawn(obj.Value);
     }
     m_channels.Clear();
     base.Close();
 }