Exemplo n.º 1
0
        public void asynSendMessageFromClient(MessageDescript descript, ClientInfo client, Action <ClientInfo, MessageDescript> allocToSendedMessage, Action <ClientInfo, Exception> allocToDropSendClient)
        {
            InfoSendRecvest info = new InfoSendRecvest(descript, client, allocToSendedMessage, allocToDropSendClient);


            sendRecvests.Enqueue(info);

            if (sendingNow)
            {
                return;
            }

            sendingNow = true;
            StartProtectedThread(SendingQueue);
        }
Exemplo n.º 2
0
        private void SendingQueue()
        {
            do
            {
                var info = new InfoSendRecvest(null, null, null, null);
                if (sendRecvests.TryDequeue(out info))
                {
                    SendMessage(info.Descript, info.Client, info.AllocToSendedMessage, info.AllocToDropSendClient);
                }
                else
                {
                    return;
                }
            }while (sendRecvests.Count() != 0);


            sendingNow = false;
        }