Exemplo n.º 1
0
        public IEnumerator <ITask> DirectLoginHandler(DirectLogin login)
        {
            if (trace)
            {
                LogInfo("DirectLogin Received");
            }

            try
            {
                TerkUserPrx terkUserPrx = directCommunicator.connectToPeer(login.Body.PeerIdentifier);
                if (trace)
                {
                    LogInfo("Connect complete!");
                }
                QwerkPrx qwerkPrx = QwerkPrxHelper.uncheckedCast(terkUserPrx);
                this.qwerkController = new QwerkController(login.Body.PeerIdentifier, qwerkPrx, directCommunicator);
            }
            catch (Exception e)
            {
                string failure = "Failed to connect to Qwerk '" + login.Body.PeerIdentifier + "': " + e;
                LogInfo(failure);
                login.ResponsePort.Post(generateFault(failure));
                yield break;
            }

            login.ResponsePort.Post(DefaultUpdateResponseType.Instance);
            yield break;
        }
Exemplo n.º 2
0
        public IEnumerator <ITask> RelayLoginHandler(RelayLogin login)
        {
            if (trace)
            {
                LogInfo("RelayLogin Received");
            }

            // login and register with the relay
            try
            {
                UserSessionPrx userSessionPrx = relayCommunicator.loginAndRegister(login.Body.TerkLogin, login.Body.TerkPassword);
                // connect to the qwerk
                try
                {
                    this.qwerkController = relayCommunicator.connectToQwerk(userSessionPrx, login.Body.QwerkLogin);
                }
                catch (PeerException e)
                {
                    string failure = "Failed to connect to Qwerk " + login.Body.QwerkLogin + ": " + e;
                    LogInfo(failure);
                    login.ResponsePort.Post(generateFault(failure));
                    yield break;
                }
            }
            catch (Exception e)
            {
                string failure = "Failed to register with the relay: " + e;
                LogInfo(failure);
                login.ResponsePort.Post(generateFault(failure));
                yield break;
            }
            login.ResponsePort.Post(DefaultUpdateResponseType.Instance);
            yield break;
        }