public void Application(ApplicationSays says, IEnumerable <Node> unconfirmedNodes)
        {
            var buffer = _outbound.PooledByteBuffer();

            MessageConverters.MessageToBytes(says, buffer.AsStream());

            var message = _node.Id.Value.ToRawMessage(buffer.AsStream());

            _outbound.Broadcast(unconfirmedNodes, _outbound.BytesFrom(message, buffer));
        }
Ejemplo n.º 2
0
        public void TestBroadcast()
        {
            var rawMessage1 = RawMessage.From(0, 0, Message1);
            var rawMessage2 = RawMessage.From(0, 0, Message2);
            var rawMessage3 = RawMessage.From(0, 0, Message3);

            _outbound.Broadcast(rawMessage1);
            _outbound.Broadcast(rawMessage2);
            _outbound.Broadcast(rawMessage3);

            foreach (var channel in _channelProvider.AllOtherNodeChannels.Values)
            {
                var mock = (MockManagedOutboundChannel)channel;

                Assert.Equal(Message1, mock.Writes[0]);
                Assert.Equal(Message2, mock.Writes[1]);
                Assert.Equal(Message3, mock.Writes[2]);
            }
        }
Ejemplo n.º 3
0
        public void TestBroadcast()
        {
            var buffer = new MemoryStream(Properties.OperationalBufferSize());

            var rawMessage1 = BuildRawMessageBuffer(buffer, _message1);
            var rawMessage2 = BuildRawMessageBuffer(buffer, _message2);
            var rawMessage3 = BuildRawMessageBuffer(buffer, _message3);

            _outbound.Broadcast(rawMessage1);
            _outbound.Broadcast(rawMessage2);
            _outbound.Broadcast(rawMessage3);

            foreach (var channel in _channelProvider.AllOtherNodeChannels.Values)
            {
                var mock = (MockManagedOutboundChannel)channel;

                Assert.Equal(_message1, mock.Writes[0]);
                Assert.Equal(_message2, mock.Writes[1]);
                Assert.Equal(_message3, mock.Writes[2]);
            }
        }
    //===================================
    // ClusterApplicationOutboundStream
    //===================================

    public void Broadcast(RawMessage message) => _outbound.Broadcast(message);