Пример #1
0
            public void Set(OrderedMessage <TSender> message)
            {
                this._buffer[message.Location] = message.Data;

                if (this._pointer == -1 && message.Data.Count == 0)
                {
                    this._pointer = message.Location;
                }
            }
Пример #2
0
        private void _checker_Receive(object sender, OrderedMessage <TSender> e)
        {
            MessageBuffer buff;

            lock (this._buffers)
            {
                if (!this._buffers.TryGetValue(e.Sender, out buff))
                {
                    this._buffers.Add(e.Sender, buff = new MessageBuffer());
                }
            }

            lock (buff)
            {
                buff.Set(e);

                foreach (var bytes in buff.Read())
                {
                    this.Receive?.Invoke(this, new SegmentMessage <TSender>(e.Sender, e.IsOwnMessage, bytes));
                }
            }
        }