コード例 #1
0
        private bool Reconnect(string handle, HoxisProtocolArgs args)
        {
            long uid = FF.StringToLong(args["uid"]);
            List <HoxisConnection> workers = HoxisServer.Ins.GetWorkingConnections();

            foreach (HoxisConnection w in workers)
            {
                // If already signed in, response the state to let user choose if reconnecting
                if (w.user == this)
                {
                    continue;
                }
                if (w.user.userID <= 0)
                {
                    continue;
                }
                if (w.user.userID == uid)
                {
                    userID       = w.user.userID;
                    realtimeData = w.user.realtimeData;
                    Continue();
                    if (DebugRecorder.LogEnable(_logger))
                    {
                        _logger.LogInfo("reconnect", "");
                    }
                    HoxisServer.Ins.AffairEntry(C.AFFAIR_RELEASE_CONNECTION, w);
                    return(ResponseSuccess(handle, "ReconnectCb"));
                }
            }
            return(Response(handle, "ReconnectCb", new KVString("code", C.RESP_NO_USER_INFO)));
        }
コード例 #2
0
 public void Reset()
 {
     userID          = 0;
     connectionState = UserConnectionState.None;
     realtimeData    = HoxisUserRealtimeData.undef;
     heartbeatTimer  = 0;
 }
コード例 #3
0
 public HoxisUser()
 {
     userID          = 0;
     connectionState = UserConnectionState.None;
     realtimeData    = HoxisUserRealtimeData.undef;
     respTable       = new Dictionary <string, ResponseHandler>();
     respTable.Add("QueryConnectionState", QueryConnectionState);
     respTable.Add("ActivateConnectionState", ActivateConnectionState);
     respTable.Add("SetDefaultConnectionState", SetDefaultConnectionState);
     respTable.Add("SignIn", SignIn);
     respTable.Add("SignOut", SignOut);
     respTable.Add("Reconnect", Reconnect);
     respTable.Add("RefreshHeartbeat", RefreshHeartbeat);
 }