Exemple #1
0
        // 发送失败 Callback
        private void HandleSendFail(string seq, int code)
        {
            SendQueueValue val = null;

            SendQueue.TryGetValue(seq + "", out val);
            if (val == null)
            {
                return;
            }

            // 处理 wssocket 帧长度超过 856B
            if (code == ErrCode.EcRelayDataExceedLimited || DateTime.Now.Subtract(val.Time).TotalMilliseconds > Config.ResendTimeout)
            {
                var sendCode = UserStatus.GetErrCode() != 0 ? UserStatus.GetErrCode() : code;
                val.sendFail(sendCode, null);
                return;
            }
            switch (code)
            {
            case (int)QAppProtoErrCode.EcSdkUninit:
                // 没有初始化
                val.sendFail(code, null);
                break;

            case (int)QAppProtoErrCode.EcSdkNoLogin:
                // 没登录
                Socket.Emit("autoAuth", new SocketEvent());
                return;

            case (int)QAppProtoErrCode.EcSdkNoCheckLogin:
            {
                // 没checklogin
                Socket.Emit("autoAuth", new SocketEvent());
                return;
            }
            }
            return;
        }