예제 #1
0
        private void SocketSended(object sender, SocketAsyncEventArgs e)
        {
            AsyncUserToken userToken  = e.UserToken as AsyncUserToken;
            SendBuffer     sendBuffer = userToken._SendBuffer;

            if (null != sendBuffer)
            {
                sendBuffer.Reset2();
            }
            TMSKSocket s = userToken.CurrentSocket;

            Global._SendBufferManager.OnSendBufferOK(s);
        }
예제 #2
0
        /// <summary>
        /// 发送数据通知函数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SocketSended(object sender, SocketAsyncEventArgs e)
        {
            ////SocketListener sl = sender as SocketListener;
            ////TMSKSocket s = (e.UserToken as AsyncUserToken).CurrentSocket;
            //TCPOutPacket tcpOutPacket = (e.UserToken as AsyncUserToken).Tag as TCPOutPacket;
            ////采用发送数据缓存后Tag被绑定为null
            //if (null != tcpOutPacket)
            //{
            //    tcpOutPacketPool.Push(tcpOutPacket);
            //}

            AsyncUserToken userToken = (e.UserToken as AsyncUserToken);

            if (!GameManager.FlagOptimizeThreadPool5 && !GameManager.FlagOptimizeThreadPool4)
            {
                MemoryBlock item = userToken.Tag as MemoryBlock;
                if (null != item)
                {
                    if (GameManager.FlagOptimizeThreadPool2)
                    {
                        TMSKThreadStaticClass.GetInstance().PushMemoryBlock(item);
                    }
                    else
                    {
                        Global._MemoryManager.Push(item);
                    }
                }
            }

            if (GameManager.FlagOptimizeThreadPool4)
            {
                SendBuffer sendBuffer = userToken._SendBuffer;
                if (null != sendBuffer)
                {
                    sendBuffer.Reset2();
                }
            }

            TMSKSocket s = userToken.CurrentSocket;

            Global._SendBufferManager.OnSendBufferOK(s);
        }