Exemple #1
0
        public void HandleResponce(IObject obj)
        {
            Log.Debug("Handle RpcResult");

            var message = obj.Cast <TRpcResult>();

            Log.Debug($"Process RpcResult  with request id = '{message.ReqMsgId}'");

            ConfirmationRecieveService.ConfirmRequest(message.ReqMsgId);

            switch (message.Result)
            {
            case TRpcError error:
                HandleRpcError(message.ReqMsgId, error);
                break;

            case TgZipPacked zipPacked:
                var result = ZipPackedHandler.HandleGZipPacked(zipPacked);
                ResponseResultSetter.ReturnResult(message.ReqMsgId, result);
                break;

            default:
                ResponseResultSetter.ReturnResult(message.ReqMsgId, message.Result);
                break;
            }
        }
        public void HandleResponce(IObject obj)
        {
            var message = obj.Cast <TFutureSalts>();

            Log.Debug($"Handle Future Salts for request {message.ReqMsgId}");

            throw new NotImplementedException("The future sault does not supported yet");
        }
Exemple #3
0
        public void HandleResponce(IObject obj)
        {
            if (Log.IsDebugEnabled)
            {
                var jUpdate = JsonConvert.SerializeObject(obj);
                Log.Debug($"Recieve Updates \n{jUpdate}");
            }

            UpdateRaiser.OnUpdateRecieve(obj.Cast <IUpdates>());
        }
Exemple #4
0
        public void HandleResponce(IObject obj)
        {
            var message = obj.Cast <TBadServerSalt>();

            Log.Info($"Bad server sault detected! message id = {message.BadMsgId} ");

            ClientSettings.Session.Salt = message.NewServerSalt;

            ConfirmationRecieveService.RequestWithException(message.BadMsgId, new BadServerSaltException());
        }
        public void HandleResponce(IObject obj)
        {
            var message = obj.Cast <TBadServerSalt>();

            Log.Info($"Bad server sault detected! message id = {message.BadMsgId} ");

            ClientSettings.Session.Salt = message.NewServerSalt;

            ResponseResultSetter.ReturnException(message.BadMsgId, new BadServerSaltException());
        }
        public void HandleResponce(IObject obj)
        {
            Log.Debug("Handle a messages ack");

            if (Log.IsDebugEnabled)
            {
                var message = obj.Cast <TMsgsAck>();

                var jMessages = JsonConvert.SerializeObject(message.MsgIds.Items);
                Log.Debug($"Receiving confirmation of the messages: {jMessages}");
            }
        }
        public void HandleResponce(IObject obj)
        {
            var message = obj.Cast <TPong>();

            if (Log.IsDebugEnabled)
            {
                var jMessages = JsonConvert.SerializeObject(message);
                Log.Debug($"Handle pong for request = {jMessages}");
            }

            ResponseResultSetter.ReturnResult(message.MsgId, obj);
        }
Exemple #8
0
        public void HandleResponce(IObject obj)
        {
            var message = obj.Cast <TPong>();

            ConfirmationRecieveService.ConfirmRequest(message.MsgId);

            if (Log.IsDebugEnabled)
            {
                var jMessages = JsonConvert.SerializeObject(message);
                Log.Debug($"Handle pong for request = {message}");
            }
        }
Exemple #9
0
        public void HandleResponce(IObject obj)
        {
            var message = obj.Cast <TBadMsgNotification>();

            Exception exception;

            switch (message.ErrorCode)
            {
            case 16:
                exception = new InvalidOperationException(
                    "msg_id too low (most likely, client time is wrong; it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the “correct” msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted)");
                break;

            case 17:
                exception = new InvalidOperationException(
                    "msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id)");
                break;

            case 18:
                exception = new InvalidOperationException(
                    "incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4)");
                break;

            case 19:
                exception = new InvalidOperationException(
                    "container msg_id is the same as msg_id of a previously received message (this must never happen)");
                break;

            case 20:
                exception = new InvalidOperationException(
                    "message too old, and it cannot be verified whether the server has received a message with this msg_id or not");
                break;

            case 32:
                exception = new InvalidOperationException(
                    "msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno)");
                break;

            case 33:
                exception = new InvalidOperationException(
                    " msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno)");
                break;

            case 34:
                exception = new InvalidOperationException(
                    "an even msg_seqno expected (irrelevant message), but odd received");
                break;

            case 35:
                exception = new InvalidOperationException("odd msg_seqno expected (relevant message), but even received");
                break;

            case 48:
                exception = new InvalidOperationException(
                    "incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it)");
                break;

            case 64:
                exception = new InvalidOperationException("invalid container");
                break;

            default:
                exception = new NotImplementedException("This should never happens");
                break;
            }

            Log.Error($"Handle a bad message notification for request id = {message.BadMsgId}", exception);

            ConfirmationRecieveService.RequestWithException(message.BadMsgId, exception);
        }
        public void HandleResponce(IObject obj)
        {
            var info = obj.Cast <TMsgDetailedInfo>();

            Log.Debug("Handle a TMsgNewDetailedInfo");
        }