Esempio n. 1
0
        /// <summary>
        /// 消息回调
        /// </summary>
        /// <param name="message"></param>
        private void sendMessage(ref DistributionMessageItem message)
        {
            bool isNext = false;

            do
            {
                if (getters[getterIndex].Send(sendIdentity, ref message.Data, ref isNext))
                {
                    message.OnSend();
                    nextSendIndex();
                    if (isNext && ++getterIndex == getterCount)
                    {
                        getterIndex = 0;
                    }
                    return;
                }
                if (--getterCount == 0)
                {
                    getters[0].OnGetMessage = null;
                    return;
                }
                if (getterIndex == getterCount)
                {
                    getterIndex = 0;
                }
                else
                {
                    getters[getterIndex] = getters[getterCount];
                }
                getters[getterCount].OnGetMessage = null;
            }while (true);
        }
Esempio n. 2
0
 /// <summary>
 /// 数据缓冲区
 /// </summary>
 /// <param name="node"></param>
 /// <param name="onReturn"></param>
 /// <param name="message"></param>
 internal Buffer(Node node, AutoCSer.Net.TcpServer.ServerCallback <ReturnParameter> onReturn, ref DistributionMessageItem message)
 {
     Node          = node;
     this.onReturn = onReturn;
     Data          = message.Data;
     BufferCount   = message.OnAppendFile();
 }
Esempio n. 3
0
 /// <summary>
 /// 数据缓冲区
 /// </summary>
 /// <param name="node"></param>
 /// <param name="onReturn"></param>
 /// <param name="message"></param>
 internal Buffer(Node node, Func <AutoCSer.Net.TcpServer.ReturnValue <ReturnParameter>, bool> onReturn, ref DistributionMessageItem message)
 {
     Node          = node;
     this.onReturn = onReturn;
     Data          = message.Data;
     BufferCount   = message.OnAppendFile();
 }