Exemplo n.º 1
0
 /// <summary>
 /// Creates a <see cref="TcpMessageCodec"/> instance.
 /// </summary>
 /// <param name="appProtocolVersion">The <see cref="AppProtocolVersion"/> to use
 /// when encoding and decoding.</param>
 /// <param name="trustedAppProtocolVersionSigners">The set of signers to trust when
 /// decoding a message.</param>
 /// <param name="differentAppProtocolVersionEncountered">A callback method that gets
 /// invoked when an <see cref="AppProtocolVersion"/> by a <em>trusted</em> signer that is
 /// different from <paramref name="appProtocolVersion"/> is encountered.</param>
 /// <param name="messageTimestampBuffer">A <see cref="TimeSpan"/> to use as a buffer
 /// when decoding <see cref="Message"/>s.</param>
 public TcpMessageCodec(
     AppProtocolVersion appProtocolVersion = default,
     IImmutableSet <PublicKey>?trustedAppProtocolVersionSigners = null,
     DifferentAppProtocolVersionEncountered?differentAppProtocolVersionEncountered = null,
     TimeSpan?messageTimestampBuffer = null)
 {
     _codec            = new Codec();
     _messageValidator = new MessageValidator(
         appProtocolVersion,
         trustedAppProtocolVersionSigners,
         differentAppProtocolVersionEncountered,
         messageTimestampBuffer);
 }