/// <inheritdoc />
        protected override async void OnEventFired(object source, EventArgs args)
        {
            //We just wanna redirect, that's all.
            await Reconnector.RedirectAsync();

            //The way Character to Ship redirection works
            //is that it shouldn't redirect again on next redirect
            //we'll still be in the same scene
            //but we need to NOT handle this again, ship to block handler will
            //exist
            Unsubscribe();
        }
Exemplo n.º 2
0
        public override void startup()
        {
            base.startup();

            if (addressParser == null)
            {
                addressParser = new RpcAddressParser();
            }

            ConnectionSelectStrategy connectionSelectStrategy = (ConnectionSelectStrategy)option(BoltGenericOption.CONNECTION_SELECT_STRATEGY);

            if (connectionSelectStrategy == null)
            {
                connectionSelectStrategy = new RandomSelectStrategy(switches());
            }
            connectionManager = new DefaultClientConnectionManager(connectionSelectStrategy, new RpcConnectionFactory(userProcessors, this), connectionEventHandler, connectionEventListener, switches());
            connectionManager.AddressParser = addressParser;
            connectionManager.startup();
            rpcRemoting = new RpcClientRemoting(new RpcCommandFactory(), addressParser, connectionManager);
            taskScanner.add(connectionManager);
            taskScanner.startup();

            if (switches().isOn(GlobalSwitch.CONN_MONITOR_SWITCH))
            {
                if (monitorStrategy == null)
                {
                    connectionMonitor = new DefaultConnectionMonitor(new ScheduledDisconnectStrategy(), connectionManager);
                }
                else
                {
                    connectionMonitor = new DefaultConnectionMonitor(monitorStrategy, connectionManager);
                }
                connectionMonitor.startup();
                logger.LogWarning("Switch on connection monitor");
            }
            if (switches().isOn(GlobalSwitch.CONN_RECONNECT_SWITCH))
            {
                reconnectManager = new ReconnectManager(connectionManager);
                reconnectManager.startup();

                connectionEventHandler.Reconnector = reconnectManager;
                logger.LogWarning("Switch on reconnect manager");
            }
        }
Exemplo n.º 3
0
        internal Client(OrtcClient ortcClient)
        {
            this.context  = ortcClient;
            _isConnecting = false;
            _alreadyConnectedFirstTime = false;
            _stopReconnecting          = false;
            _callDisconnectedCallback  = false;
            _waitingServerResponse     = false;

            _gotOnOpenCount = 0;

            _permissions = new List <KeyValuePair <string, string> >();

            _lastKeepAlive      = null;
            _reconnectStartedAt = null;
            _reconnectTimer     = new Reconnector();//= null;

            _subscribedChannels      = new ConcurrentDictionary <string, ChannelSubscription>();
            _multiPartMessagesBuffer = new ConcurrentDictionary <string, ConcurrentDictionary <int, BufferedMessage> >();

            TimerCallback hbCb = this._heartbeatTimer_Elapsed;

            _heartbeatTimer = new Timer(hbCb, null, Timeout.Infinite, context.HeartbeatTime);
            TimerCallback cnCB = this._connectionTimer_Elapsed;

            _connectionTimer           = new Timer(cnCB, null, System.Threading.Timeout.Infinite, Constants.SERVER_HB_COUNT);
            _connectionTimerIsDisposed = false;

            //_webSocketConnection = new Connection(_reconnectTimer);
            //_webSocketConnection.OnOpened += new Connection.onOpenedDelegate(_webSocketConnection_OnOpened);
            //_webSocketConnection.OnClosed += new Connection.onClosedDelegate(_webSocketConnection_OnClosed);
            //_webSocketConnection.OnError += new Connection.onErrorDelegate(_webSocketConnection_OnError);
            //_webSocketConnection.OnMessageReceived += new Connection.onMessageReceivedDelegate(_webSocketConnection_OnMessageReceived);

            _msgProcessor = new MsgProcessor(this);
        }
Exemplo n.º 4
0
 void ResetCamCofnig(ScanConfig config)
 {
     Reconnector[config]();
     Cam.EvtResist(Cam.Xfer, GrabDoneEvt_Trg);
 }