Esempio n. 1
0
 protected ProxyReactorBase(INode nodeConfig,
                            IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                            int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(nodeConfig, encoder, decoder, allocator, bufferSize)
 {
     BufferSize   = bufferSize;
     networkState = CreateNetworkState(Listener, this.LocalEndpoint, allocator.Buffer(bufferSize), bufferSize);
 }
Esempio n. 2
0
 public SerialPortReactor(NodeConfig nodeConfig,
                          IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                          int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(nodeConfig, encoder, decoder, allocator,
            bufferSize)
 {
     networkState = CreateNetworkState(Listener, this.LocalEndpoint, allocator.Buffer(bufferSize), bufferSize);
 }
Esempio n. 3
0
 /// <summary>
 ///     Expand the existing cumulative <see cref="IByteBuf" />.
 /// </summary>
 private static IByteBuf ExpandCumulation(IByteBufAllocator alloc, IByteBuf cumulation, int readable)
 {
     var old = cumulation;
     cumulation = alloc.Buffer(old.ReadableBytes + readable);
     cumulation.WriteBytes(old);
     old.Release();
     return cumulation;
 }
Esempio n. 4
0
        /// <summary>
        ///     Expand the existing cumulative <see cref="IByteBuf" />.
        /// </summary>
        private static IByteBuf ExpandCumulation(IByteBufAllocator alloc, IByteBuf cumulation, int readable)
        {
            var old = cumulation;

            cumulation = alloc.Buffer(old.ReadableBytes + readable);
            cumulation.WriteBytes(old);
            old.Release();
            return(cumulation);
        }
 public IByteBuf Allocate(IByteBufAllocator allocator)
 {
     return(allocator.Buffer(_bufferSize));
 }
Esempio n. 6
0
 public static IByteBuf Buffer()
 {
     return(Alloc.Buffer());
 }
 public IByteBuf Allocate(IByteBufAllocator allocator)
 {
     return allocator.Buffer(_bufferSize);
 }