protected override void OnData(ByteString data) { msg_buffer = msg_buffer.Concat(data); for (Message message = TryParseMessage(); message != null; message = TryParseMessage()) { protocol.Tell(message); } }
protected override void OnData(ByteString data) { //_log.LogInformation($"RemoteNode OnData {data.Count} bytes."); msg_buffer = msg_buffer.Concat(data); for (Message message = TryParseMessage(); message != null; message = TryParseMessage()) { protocol.Tell(message); } }
public void InputStreamSink_should_return_less_than_was_expected_when_data_source_has_provided_some_but_not_enough_data() { this.AssertAllStagesStopped(() => { var inputStream = Source.Single(_byteString).RunWith(StreamConverters.AsInputStream(), _materializer); var arr = new byte[_byteString.Count + 1]; inputStream.Read(arr, 0, arr.Length).Should().Be(arr.Length - 1); inputStream.Close(); ByteString.Create(arr).ShouldBeEquivalentTo(_byteString.Concat(ByteString.Create(new byte[] { 0 }))); }, _materializer); }
//private List<String> attrs; public TransactionContext(Channel channel, IUser user, ICryptoSuite cryptoPrimitives) { User = user; Channel = channel; //TODO clean up when public classes are interfaces. Verify = !"".Equals(channel.Name); //if name is not blank not system channel and need verify. // this.txID = transactionID; CryptoPrimitives = cryptoPrimitives; // Get the signing identity from the user signingIdentity = IdentityFactory.GetSigningIdentity(cryptoPrimitives, user); // Serialize signingIdentity Identity = signingIdentity.CreateSerializedIdentity(); ByteString no = Nonce; byte[] comp = no.Concat(Identity.ToByteArray()).ToArray(); byte[] txh = cryptoPrimitives.Hash(comp); // txID = Hex.encodeHexString(txh); TxID = txh.ToHexString(); toString = $"TransactionContext {{ txID: {TxID} mspid: {user.MspId}, user: {user.Name} }}"; }
public override void OnPush() { _hasBeenPushed = true; var bytes = Grab(_stage.In); if (!_overflowBuffer.IsEmpty) { // There's overflown data leftover from previous operations, append it to the current data bytes = _overflowBuffer.Concat(bytes); _overflowBuffer = ByteString.Empty; } if (_feeder.Position != _feeder.Length) { // There's data in the buffer, so append the new data to the old data var oldBytes = new byte[_feeder.Length - _feeder.Position]; _feeder.Read(oldBytes, 0, oldBytes.Length); bytes = ByteString.FromBytes(oldBytes).Concat(bytes); } FillStreamBuffer(bytes); AdvanceParser(); }
public static string concatByteString(ByteString a, ByteString b) { return((a + b) + a.Concat(b)); }