Esempio n. 1
0
 public MulticastUdpConnection(NetworkEventLoop eventLoop, INode binding, INode multicastAddress,
     TimeSpan timeout, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator)
     : base(eventLoop, binding, timeout, encoder, decoder, allocator)
 {
     MulticastAddress = multicastAddress;
     InitMulticastClient();
 }
Esempio n. 2
0
 public MulticastUdpConnection(NetworkEventLoop eventLoop, INode binding, INode multicastAddress,
     IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator)
     : this(
         eventLoop, binding, multicastAddress, NetworkConstants.DefaultConnectivityTimeout, encoder, decoder,
         allocator)
 {
 }
Esempio n. 3
0
 public UdpConnection(Socket client, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator)
 {
     InitClient(client);
     Encoder = encoder;
     Decoder = decoder;
     Allocator = allocator;
 }
Esempio n. 4
0
 protected ProxyReactorBase(NodeConfig nodeConfig,
                            IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                            int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(nodeConfig, encoder, decoder, allocator, bufferSize)
 {
     BufferSize = bufferSize;
 }
Esempio n. 5
0
 protected UnstreamedConnectionBase(NetworkEventLoop eventLoop, INode binding, IMessageEncoder encoder,
                                    IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : this(
         eventLoop, binding, NetworkConstants.DefaultConnectivityTimeout, encoder, decoder, allocator, bufferSize
         )
 {
 }
Esempio n. 6
0
 public UdpConnection(Socket client, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator)
 {
     InitClient(client);
     Encoder   = encoder;
     Decoder   = decoder;
     Allocator = allocator;
 }
 protected SingleReceiveLoopProxyReactor(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
     IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
     SocketType socketType = SocketType.Stream, ProtocolType protocol = ProtocolType.Tcp,
     int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(localAddress, localPort, eventLoop, encoder, decoder, allocator, socketType, protocol, bufferSize)
 {
 }
Esempio n. 8
0
 public AlternativeCompositeByteBuf(IByteBufAllocator alloc, bool direct, params ByteBuf[] buffers)
 {
     _alloc  = alloc;
     _direct = direct;
     AddComponent(buffers);
     // TODO leak needed? leak = leakDetector.open(this);
 }
 protected UnstreamedConnectionBase(NetworkEventLoop eventLoop, INode binding, IMessageEncoder encoder,
     IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : this(
         eventLoop, binding, NetworkConstants.DefaultConnectivityTimeout, encoder, decoder, allocator, bufferSize
         )
 {
 }
Esempio n. 10
0
 public MulticastUdpConnection(Socket client, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator)
     : base(client)
 {
     InitMulticastClient();
     Encoder = encoder;
     Decoder = decoder;
     Allocator = allocator;
 }
Esempio n. 11
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. 12
0
 protected ProxyReactorBase(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
                            IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                            SocketType socketType = SocketType.Stream, ProtocolType protocol = ProtocolType.Tcp,
                            int bufferSize        = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(localAddress, localPort, eventLoop, encoder, decoder, allocator, socketType, protocol, bufferSize)
 {
     BufferSize = bufferSize;
 }
Esempio n. 13
0
 public TcpConnection(Socket client, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(bufferSize)
 {
     InitClient(client);
     Encoder = encoder;
     Decoder = decoder;
     Allocator = allocator;
 }
Esempio n. 14
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. 15
0
 public TcpConnection(TcpClient client, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(bufferSize)
 {
     InitClient(client);
     Encoder   = encoder;
     Decoder   = decoder;
     Allocator = allocator;
 }
Esempio n. 16
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. 17
0
 public MulticastUdpConnection(UdpClient client, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator)
     : base(client)
 {
     InitMulticastClient();
     Encoder   = encoder;
     Decoder   = decoder;
     Allocator = allocator;
 }
Esempio n. 18
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. 19
0
 public TcpProxyReactor(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
     IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
     int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(
         localAddress, localPort, eventLoop, encoder, decoder, allocator, SocketType.Stream, ProtocolType.Tcp,
         bufferSize)
 {
     LocalEndpoint = new IPEndPoint(localAddress, localPort);
     Listener = new Socket(LocalEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
 }
Esempio n. 20
0
 public TcpProxyReactor(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
                        IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                        int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(
         localAddress, localPort, eventLoop, encoder, decoder, allocator, SocketType.Stream, ProtocolType.Tcp,
         bufferSize)
 {
     LocalEndpoint = new IPEndPoint(localAddress, localPort);
     Listener      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 }
Esempio n. 21
0
 public UdpProxyReactor(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
                        IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                        int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(
         localAddress, localPort, eventLoop, encoder, decoder, allocator, SocketType.Dgram, ProtocolType.Udp,
         bufferSize)
 {
     LocalEndpoint  = new IPEndPoint(localAddress, localPort);
     RemoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
 }
Esempio n. 22
0
 public UdpProxyReactor(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
     IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
     int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(
         localAddress, localPort, eventLoop, encoder, decoder, allocator, SocketType.Dgram, ProtocolType.Udp,
         bufferSize)
 {
     LocalEndpoint = new IPEndPoint(localAddress, localPort);
     RemoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
 }
Esempio n. 23
0
        public UnpooledDirectByteBuf(IByteBufAllocator alloc, byte[] initialArray, int readerIndex, int writerIndex,
            int maxCapacity) : base(maxCapacity)
        {
            Contract.Requires(alloc != null);
            Contract.Requires(initialArray != null);
            Contract.Requires(initialArray.Length <= maxCapacity);

            Allocator = alloc;
            SetBuffer(initialArray);
            SetIndex(readerIndex, writerIndex);
        }
Esempio n. 24
0
        public UnpooledDirectByteBuf(IByteBufAllocator alloc, int initialCapacity, int maxCapacity) : base(maxCapacity)
        {
            if(alloc == null) throw new ArgumentNullException("alloc");
            if(initialCapacity < 0) throw new ArgumentOutOfRangeException("initialCapacity", "initialCapacity must be at least 0");
            if(maxCapacity < 0) throw new ArgumentOutOfRangeException("maxCapacity", "maxCapacity must be at least 0");
            if(initialCapacity > maxCapacity) throw new ArgumentException(string.Format("initialCapacity {0} must be less than maxCapacity {1}", initialCapacity, maxCapacity));

            _alloc = alloc;
            _capacity = initialCapacity;
            SetByteBuffer(ByteBuffer.AllocateDirect(initialCapacity));
        }
Esempio n. 25
0
        public UnpooledDirectByteBuf(IByteBufAllocator alloc, byte[] initialArray, int readerIndex, int writerIndex,
                                     int maxCapacity) : base(maxCapacity)
        {
            Contract.Requires(alloc != null);
            Contract.Requires(initialArray != null);
            Contract.Requires(initialArray.Length <= maxCapacity);

            Allocator = alloc;
            SetBuffer(initialArray);
            SetIndex(readerIndex, writerIndex);
        }
Esempio n. 26
0
        protected ReactorBase(INode listener, IMessageEncoder encoder,
                              IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
        {
            Decoder   = decoder;
            Encoder   = encoder;
            Allocator = allocator;

            Listener          = listener;
            Backlog           = NetworkConstants.DefaultBacklog;
            BufferSize        = bufferSize;
            ConnectionAdapter = new ReactorConnectionAdapter(this);
        }
Esempio n. 27
0
        public SingleThreadEventloop()
        {
            this.alloc          = DefaultByteBufAllocator.Default;
            this.taskQueue      = new ConcurrentQueue <IRunnable>();
            this.schedulerQueue = new PriorityQueue <ISchedulerRunable>();

            thread = new Thread(loop)
            {
                IsBackground = true
            };
            thread.Start();
        }
Esempio n. 28
0
 public CompositeByteBuf(IByteBufAllocator alloc, bool direct, int maxNumComponents, params ByteBuf[] buffers)
     : base(Int32.MaxValue)
 {
     if (alloc == null)
     {
         throw new NullReferenceException("alloc");
     }
     _alloc = alloc;
     _direct = direct;
     _maxNumComponents = maxNumComponents;
     // TODO leak detector needed?
 }
 protected UnstreamedConnectionBase(NetworkEventLoop eventLoop, INode binding, TimeSpan timeout, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base()
 {
     Decoder = decoder;
     Encoder = encoder;
     Allocator = allocator;
     Created = DateTimeOffset.UtcNow;
     Binding = binding;
     Timeout = timeout;
     BufferSize = bufferSize;
     NetworkEventLoop = eventLoop;
 }
Esempio n. 30
0
 public CompositeByteBuf(IByteBufAllocator alloc, bool direct, int maxNumComponents, params ByteBuf[] buffers)
     : base(Int32.MaxValue)
 {
     if (alloc == null)
     {
         throw new NullReferenceException("alloc");
     }
     _alloc            = alloc;
     _direct           = direct;
     _maxNumComponents = maxNumComponents;
     // TODO leak detector needed?
 }
Esempio n. 31
0
 protected UnstreamedConnectionBase(NetworkEventLoop eventLoop, INode binding, TimeSpan timeout, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base()
 {
     Decoder          = decoder;
     Encoder          = encoder;
     Allocator        = allocator;
     Created          = DateTimeOffset.UtcNow;
     Binding          = binding;
     Timeout          = timeout;
     BufferSize       = bufferSize;
     NetworkEventLoop = eventLoop;
 }
Esempio n. 32
0
        public UdpProxyReactor(INode listener,
                               IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                               int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
            : base(listener, encoder, decoder, allocator,
                   bufferSize)
        {
            UdpNodeConfig nodeConfig = listener.nodeConfig as UdpNodeConfig;

            LocalEndPoint  = new IPEndPoint(IPAddress.Parse(nodeConfig.LocalAddress), nodeConfig.LocalPort);
            RemoteEndPoint = new IPEndPoint(IPAddress.Any, nodeConfig.LocalPort);
            ListenerSocket = new Socket(LocalEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
        }
Esempio n. 33
0
 protected ReactorBase(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, SocketType socketType = SocketType.Stream, ProtocolType protocol = ProtocolType.Tcp, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
 {
     Decoder = decoder;
     Encoder = encoder;
     Allocator = allocator;
     LocalEndpoint = new IPEndPoint(localAddress, localPort);
     Listener = new Socket(AddressFamily.InterNetwork, socketType, protocol);
     if (protocol == ProtocolType.Tcp) { Transport = TransportType.Tcp; } else if (protocol == ProtocolType.Udp) { Transport = TransportType.Udp; }
     Backlog = NetworkConstants.DefaultBacklog;
     EventLoop = eventLoop;
     ConnectionAdapter = new ReactorConnectionAdapter(this);
     BufferSize = bufferSize;
 }
Esempio n. 34
0
 /// <summary>
 /// 执行通道已注册到Eventloop事件
 /// </summary>
 public Task fireOnChannelRegister(TaskCompletionSource promise)
 {
     Execute(() =>
     {
         alloc = NewByteBufAlloc();
         pipeline.SetAlloc(alloc);
         if (eventloop.Alloc == null)
         {
             eventloop.SetAlloc(alloc);
         }
         pipeline.fireChannelRegister();
     });
     return(promise.Task);
 }
Esempio n. 35
0
        public MutlEventloopGroup(Func <IEventloop> eventloopFactory, int eventloopCount, IByteBufAllocator bufAlloc = null)
        {
            //Ensure.Ensures(bufAlloc.ArenaCounter < eventloopCount, "IByteBufAllocator.ArenaCounter数量不能小于EventloopCounter");

            this.NewEventloopFactory = eventloopFactory;
            this.ByteBufAllocator    = bufAlloc;

            loops = new IEventloop[eventloopCount];
            for (int i = 0; i < eventloopCount; i++)
            {
                loops[i] = NewEventloopFactory();
                if (bufAlloc != null)
                {
                    loops[i].SetAlloc(bufAlloc);
                }
            }
        }
Esempio n. 36
0
        public SerialPortReactor(INode listener,
                                 IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                                 int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
            : base(listener, encoder, decoder, allocator,
                   bufferSize)
        {
            SerialNodeConfig nodeConfig = listener.nodeConfig as SerialNodeConfig;

            ListenerSocket = new SerialPort
            {
                PortName = nodeConfig.PortName,
                BaudRate = nodeConfig.BaudRate,
                DataBits = nodeConfig.DataBits,
                StopBits = nodeConfig.StopBits,
                Parity   = nodeConfig.Parity,
                ReceivedBytesThreshold = 1
            };
        }
Esempio n. 37
0
 protected ReactorBase(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, SocketType socketType = SocketType.Stream, ProtocolType protocol = ProtocolType.Tcp, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
 {
     Decoder       = decoder;
     Encoder       = encoder;
     Allocator     = allocator;
     LocalEndpoint = new IPEndPoint(localAddress, localPort);
     Listener      = new Socket(AddressFamily.InterNetwork, socketType, protocol);
     if (protocol == ProtocolType.Tcp)
     {
         Transport = TransportType.Tcp;
     }
     else if (protocol == ProtocolType.Udp)
     {
         Transport = TransportType.Udp;
     }
     Backlog           = NetworkConstants.DefaultBacklog;
     EventLoop         = eventLoop;
     ConnectionAdapter = new ReactorConnectionAdapter(this);
     BufferSize        = bufferSize;
 }
Esempio n. 38
0
        protected ReactorBase(NodeConfig nodeConfig, IMessageEncoder encoder,
                              IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
        {
            Decoder   = decoder;
            Encoder   = encoder;
            Allocator = allocator;

            Listener          = new SerialPort();
            Listener.PortName = nodeConfig.PortName;
            Listener.BaudRate = nodeConfig.BaudRate;
            Listener.DataBits = nodeConfig.DataBits;
            Listener.StopBits = nodeConfig.StopBits;
            Listener.Parity   = nodeConfig.Parity;
            Listener.ReceivedBytesThreshold = 1;

            //LocalEndpoint = new IPEndPoint(localAddress, localPort);
            Backlog           = NetworkConstants.DefaultBacklog;
            BufferSize        = bufferSize;
            ConnectionAdapter = new ReactorConnectionAdapter(this);
        }
Esempio n. 39
0
        private UnpooledHeapByteBuf(IByteBufAllocator alloc, sbyte[] initialArray, int readerIndex, int writerIndex,
            int maxCapacity)
            : base(maxCapacity)
        {
            if (alloc == null)
            {
                throw new NullReferenceException("alloc");
            }
            if (initialArray == null)
            {
                throw new NullReferenceException("initialArray");
            }
            if (initialArray.Length > maxCapacity)
            {
                throw new ArgumentException(String.Format(
                        "initialCapacity({0}) > maxCapacity({1})", initialArray.Length, maxCapacity));
            }

            _alloc = alloc;
            SetArray(initialArray);
            SetIndex(readerIndex, writerIndex);
        }
Esempio n. 40
0
        private UnpooledHeapByteBuf(IByteBufAllocator alloc, sbyte[] initialArray, int readerIndex, int writerIndex,
                                    int maxCapacity)
            : base(maxCapacity)
        {
            if (alloc == null)
            {
                throw new NullReferenceException("alloc");
            }
            if (initialArray == null)
            {
                throw new NullReferenceException("initialArray");
            }
            if (initialArray.Length > maxCapacity)
            {
                throw new ArgumentException(String.Format(
                                                "initialCapacity({0}) > maxCapacity({1})", initialArray.Length, maxCapacity));
            }

            _alloc = alloc;
            SetArray(initialArray);
            SetIndex(readerIndex, writerIndex);
        }
Esempio n. 41
0
        public UnpooledDirectByteBuf(IByteBufAllocator alloc, int initialCapacity, int maxCapacity) : base(maxCapacity)
        {
            if (alloc == null)
            {
                throw new ArgumentNullException("alloc");
            }
            if (initialCapacity < 0)
            {
                throw new ArgumentOutOfRangeException("initialCapacity", "initialCapacity must be at least 0");
            }
            if (maxCapacity < 0)
            {
                throw new ArgumentOutOfRangeException("maxCapacity", "maxCapacity must be at least 0");
            }
            if (initialCapacity > maxCapacity)
            {
                throw new ArgumentException(string.Format("initialCapacity {0} must be less than maxCapacity {1}", initialCapacity, maxCapacity));
            }

            _alloc    = alloc;
            _capacity = initialCapacity;
            SetByteBuffer(ByteBuffer.AllocateDirect(initialCapacity));
        }
Esempio n. 42
0
        public UnpooledDirectByteBuf(IByteBufAllocator alloc, int initialCapacity, int maxCapacity)
            : base(maxCapacity)
        {
            if (alloc == null)
            {
                throw new NullReferenceException("alloc");
            }
            if (initialCapacity < 0)
            {
                throw new ArgumentException("initialCapacity: " + initialCapacity);
            }
            if (maxCapacity < 0)
            {
                throw new ArgumentException("maxCapacity: " + maxCapacity);
            }
            if (initialCapacity > maxCapacity)
            {
                throw new ArgumentException(String.Format(
                                                "initialCapacity({0}) > maxCapacity({1})", initialCapacity, maxCapacity));
            }

            _alloc = alloc;
            SetByteBuffer(Convenient.AllocateDirect(initialCapacity));
        }
        public UnpooledDirectByteBuf(IByteBufAllocator alloc, int initialCapacity, int maxCapacity)
            : base(maxCapacity)
        {
            if (alloc == null)
            {
                throw new NullReferenceException("alloc");
            }
            if (initialCapacity < 0)
            {
                throw new ArgumentException("initialCapacity: " + initialCapacity);
            }
            if (maxCapacity < 0)
            {
                throw new ArgumentException("maxCapacity: " + maxCapacity);
            }
            if (initialCapacity > maxCapacity)
            {
                throw new ArgumentException(String.Format(
                        "initialCapacity({0}) > maxCapacity({1})", initialCapacity, maxCapacity));
            }

            _alloc = alloc;
            SetByteBuffer(Convenient.AllocateDirect(initialCapacity));
        }
Esempio n. 44
0
 public DummyConnection(IByteBufAllocator allocator)
 {
     Allocator = allocator;
 }
Esempio n. 45
0
 public TcpSingleEventLoopProxyReactor(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
                                       IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
                                       int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(localAddress, localPort, eventLoop, encoder, decoder, allocator, bufferSize)
 {
 }
Esempio n. 46
0
 public UnpooledHeapByteBuf(IByteBufAllocator alloc, sbyte[] initialArray, int maxCapacity)
     : this(alloc, initialArray, 0, initialArray.Length, maxCapacity)
 { }
 public IByteBuf Allocate(IByteBufAllocator allocator)
 {
     return(allocator.Buffer(_bufferSize));
 }
Esempio n. 48
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 internal protected CircularByteBuf(IByteBufAllocator allocator, ICircularBuffer<byte> buffer) : base(buffer.MaxCapacity)
 {
     InternalBuffer = buffer;
     Alloc = allocator;
 }
 public IByteBuf Allocate(IByteBufAllocator allocator)
 {
     return allocator.Buffer(_bufferSize);
 }
Esempio n. 50
0
        //private MemoryStream _tmpNioBuf;

        public UnpooledHeapByteBuf(IByteBufAllocator alloc, int initialCapacity, int maxCapacity)
            : this(alloc, new sbyte[initialCapacity], 0, 0, maxCapacity)
        { }
Esempio n. 51
0
 public void SetAlloc(IByteBufAllocator bufAlloc)
 {
     this.alloc = bufAlloc;
 }
Esempio n. 52
0
 public new ServerBootstrap SetAllocator(IByteBufAllocator allocator)
 {
     base.SetAllocator(allocator);
     return(this);
 }
Esempio n. 53
0
 public virtual AbstractBootstrap SetAllocator(IByteBufAllocator allocator)
 {
     Allocator = allocator;
     return this;
 }
Esempio n. 54
0
 public TcpSingleEventLoopProxyReactor(IPAddress localAddress, int localPort, NetworkEventLoop eventLoop,
     IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator,
     int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(localAddress, localPort, eventLoop, encoder, decoder, allocator, bufferSize)
 {
 }
Esempio n. 55
0
 public EmptyByteBuf(IByteBufAllocator allocator) : base(0)
 {
     Allocator = allocator;
 }
Esempio n. 56
0
 public UdpConnection(NetworkEventLoop eventLoop, INode binding, IMessageEncoder encoder, IMessageDecoder decoder,
     IByteBufAllocator allocator)
     : base(eventLoop, binding, encoder, decoder, allocator)
 {
     InitClient();
 }
Esempio n. 57
0
 public TcpConnection(NetworkEventLoop eventLoop, INode node, IMessageEncoder encoder, IMessageDecoder decoder, IByteBufAllocator allocator, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(eventLoop, node, encoder, decoder, allocator, bufferSize)
 {
     InitClient();
 }
Esempio n. 58
0
 public new ClientBootstrap SetAllocator(IByteBufAllocator allocator)
 {
     base.SetAllocator(allocator);
     return this;
 }