IEventLoop implementation intended to be used with Non-blocking I/O (NIO) implementations of IConnection. Uses IFibers and a fixed size threadpool internally.
Inheritance: Helios.Ops.Executors.ThreadedEventLoop
 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)
 {
 }
示例#2
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);
 }
示例#3
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);
 }
 protected ReactorResponseChannel(ReactorBase reactor, Socket outboundSocket, IPEndPoint endPoint, NetworkEventLoop eventLoop)
 {
     _reactor = reactor;
     Socket = outboundSocket;
     Decoder = _reactor.Decoder.Clone();
     Encoder = _reactor.Encoder.Clone();
     Allocator = _reactor.Allocator;
     Local = reactor.LocalEndpoint.ToNode(reactor.Transport);
     RemoteHost = NodeBuilder.FromEndpoint(endPoint);
     NetworkEventLoop = eventLoop;
 }
示例#5
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;
 }
 public ReactorProxyResponseChannel(ReactorBase reactor, Socket outboundSocket, IPEndPoint endPoint,
     NetworkEventLoop eventLoop)
     : base(reactor, outboundSocket, endPoint, eventLoop)
 {
 }
        protected ReactorResponseChannel(ReactorBase reactor, Socket outboundSocket, NetworkEventLoop eventLoop)
            : this(reactor, outboundSocket, (IPEndPoint)outboundSocket.RemoteEndPoint, eventLoop)
        {

        }
示例#8
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)
 {
 }
示例#9
0
        public NetworkEventLoop Clone(bool shareFiber = false)
        {
            NetworkEventLoop eventLoop;
            if (shareFiber)
                eventLoop = new NetworkEventLoop(new SharedFiber(Scheduler));
            else
                eventLoop = new NetworkEventLoop(Scheduler.Clone());

            eventLoop.Receive = Receive;
            eventLoop.Connection = Connection;
            eventLoop.Disconnection = Disconnection;

            return eventLoop;
        }
 public TcpReactorResponseChannel(ReactorBase reactor, Socket outboundSocket, IPEndPoint endPoint,
     NetworkEventLoop eventLoop, int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : base(reactor, outboundSocket, endPoint, eventLoop)
 {
 }
 public TcpReactorResponseChannel(ReactorBase reactor, Socket outboundSocket, NetworkEventLoop eventLoop,
     int bufferSize = NetworkConstants.DEFAULT_BUFFER_SIZE)
     : this(reactor, outboundSocket, (IPEndPoint) outboundSocket.RemoteEndPoint, eventLoop, bufferSize)
 {
 }