Exemplo n.º 1
0
        public IConnection NewConnection(INode localEndpoint, INode remoteEndpoint)
        {
            var connection = CreateConnection(localEndpoint, remoteEndpoint);

            connection.Configure(Config);

            if (ReceivedData != null)
            {
                connection.Receive += (ReceivedDataCallback)ReceivedData.Clone();
            }
            if (ConnectionEstablishedCallback != null)
            {
                connection.OnConnection += (ConnectionEstablishedCallback)ConnectionEstablishedCallback.Clone();
            }
            if (ConnectionTerminatedCallback != null)
            {
                connection.OnDisconnection += (ConnectionTerminatedCallback)ConnectionTerminatedCallback.Clone();
            }
            if (ExceptionCallback != null)
            {
                connection.OnError += (ExceptionCallback)ExceptionCallback.Clone();
            }

            return(connection);
        }
Exemplo n.º 2
0
        public IReactor NewReactor(INode listenAddress)
        {
            var reactor = NewReactorInternal(listenAddress);

            reactor.Configure(Config);

            if (ReceivedData != null)
            {
                reactor.OnReceive += (ReceivedDataCallback)ReceivedData.Clone();
            }
            if (ConnectionEstablishedCallback != null)
            {
                reactor.OnConnection += (ConnectionEstablishedCallback)ConnectionEstablishedCallback.Clone();
            }
            if (ConnectionTerminatedCallback != null)
            {
                reactor.OnDisconnection += (ConnectionTerminatedCallback)ConnectionTerminatedCallback.Clone();
            }
            if (ExceptionCallback != null)
            {
                reactor.OnError += (ExceptionCallback)ExceptionCallback.Clone();
            }

            return(reactor);
        }
Exemplo n.º 3
0
        public IReactor NewReactor(INode listenAddress)
        {
            var reactor = NewReactorInternal(listenAddress);

            reactor.Configure(Config);
            reactor.LocalEndpoint = listenAddress;
            if (ReceivedData != null)
            {
                reactor.OnReceive += (ReceivedDataCallback)ReceivedData.Clone();
            }
            return(reactor);
        }