private byte[] AssembleSessionMessage(SessionMessageBase message,
                                              uint sequenceNumber,
                                              uint sourceParticipantId,
                                              uint targetParticipantId = 0)
        {
            var fragment = new SessionFragmentMessage();

            fragment.Header.IsFragment         = message.Header.IsFragment;
            fragment.Header.ChannelId          = message.Header.ChannelId;
            fragment.Header.RequestAcknowledge = message.Header.RequestAcknowledge;
            fragment.Header.SessionMessageType = message.Header.SessionMessageType;
            fragment.Header.Version            = message.Header.Version;

            fragment.Header.SequenceNumber      = sequenceNumber;
            fragment.Header.SourceParticipantId = sourceParticipantId;
            fragment.Header.TargetParticipantId = targetParticipantId;

            var writer = new EndianWriter();

            message.Serialize(writer);
            fragment.Fragment = writer.ToBytes();

            ((ICryptoMessage)fragment).Crypto = _crypto;

            var finalWriter = new EndianWriter();

            fragment.Serialize(finalWriter);
            return(finalWriter.ToBytes());
        }
Ejemplo n.º 2
0
 public async Task SendMessage(SessionMessageBase msg)
 {
     await _sessionMessageTransport.SendAsync(msg);
 }