Пример #1
0
 public WrxCommandClient(
     IPacketWriter <WrxPacket> requestWriter,
     IPacketReader <WrxPacket> responseReader,
     ArrayPool <byte> byteArrayPool,
     bool doNotDisposeRequestWriter  = false,
     bool doNotDisposeResponseReader = false)
 {
     _requestWriter  = AsyncDisposableArg.Create(requestWriter, doNotDisposeRequestWriter);
     _responseReader = AsyncDisposableArg.Create(responseReader, doNotDisposeResponseReader);
     _byteArrayPool  = byteArrayPool;
 }
Пример #2
0
        public WrxCommandServer(
            IPacketReader <WrxPacket> requestReader,
            IPacketWriter <WrxPacket> responseWriter,
            IAsyncWrxCommandHandler commandHandler,
            ArrayPool <byte> byteArrayPool,
            bool doNotDisposeRequestReader  = false,
            bool doNotDisposeResponseWriter = false)
        {
            _requestReader  = AsyncDisposableArg.Create(requestReader, doNotDisposeRequestReader);
            _responseWriter = AsyncDisposableArg.Create(responseWriter, doNotDisposeResponseWriter);
            _commandHandler = commandHandler;
            _byteArrayPool  = byteArrayPool;

            _disposePacketCallback = state =>
            {
                if (state is byte[] array)
                {
                    _byteArrayPool.Return(array);
                }
            };
        }
Пример #3
0
 public SimpleSequentialStream(IAsyncEnumerator <AsyncDisposableArg <IAsyncSimpleStream <T> > > streams) :
     this(AsyncDisposableArg.Create(SimpleStreams.Empty <T>(), false), streams)
 {
 }
Пример #4
0
 public SimpleSequentialStream(IAsyncEnumerable <AsyncDisposableArg <IAsyncSimpleStream <T> > > streams, CancellationToken cancellationToken = default) :
     this(AsyncDisposableArg.Create(SimpleStreams.Empty <T>(), false), streams, cancellationToken)
 {
 }
Пример #5
0
 public SimpleSequentialStream(IAsyncEnumerable <IAsyncSimpleStream <T> > streams, bool doNotDisposeStreams = false, CancellationToken cancellationToken = default) :
     this(streams.Select(s => AsyncDisposableArg.Create(s, doNotDisposeStreams)), cancellationToken)
 {
 }
Пример #6
0
 public SimpleSequentialStream(IEnumerable <IAsyncSimpleStream <T> > streams, bool doNotDisposeStreams = false) :
     this(streams.Select(s => AsyncDisposableArg.Create(s, doNotDisposeStreams)))
 {
 }
Пример #7
0
 public SimpleSequentialStream(params IAsyncSimpleStream <T>[] streams) :
     this(streams.Select(s => AsyncDisposableArg.Create(s, false)))
 {
 }