Пример #1
0
        public NetOutgoingMessage CreateMessage(NetOutgoingMessageContext context, IEnumerable <NetConnection> recipients)
        {
            var container = new NetOutgoingMessageContainer(context, _peer.CreateMessage(), recipients);

            _containers.Enqueue(container);

            return(container.Message);
        }
Пример #2
0
        public void Flush()
        {
            while (_containers.Any())
            {
                _container = _containers.Dequeue();
                _users.Clear();
                _users.AddRange(_container.Recipients);

                if (_users.Any())
                {
                    _peer.SendMessage(
                        msg: _container.Message,
                        recipients: _users,
                        method: _container.Context.Method,
                        sequenceChannel: _container.Context.SequenceChannel);
                }
            }
        }