Esempio n. 1
0
        public virtual void LoadServerList()
        {
            var serverListPath = GlobalConfig.ServerListUrl;

            try
            {
                var sList = new HashMap <string, ServerInfo>();
                var gList = new HashMap <string, List <ServerInfo> >();
                //log.Warn("Load Server From : " + serverListPath + "\n" + Resource.LoadAllText(GlobalConfig.ServerListUrl));
                var doc = ServerInfo.LoadServerList(serverListPath, GlobalConfig.RealmID, sList, gList);
                log.Warn("LoadServerList From : " + serverListPath + "\n" + doc.ToXmlString());
                using (serverListLock.EnterWrite())
                {
                    foreach (var e in sList)
                    {
                        log.Warn($"{e.Value} reload");
                    }
                    this.serverList.PutAll(sList);
                    this.groupList.PutAll(gList);
                }
            }
            catch (Exception err)
            {
                throw new Exception("LoadServerList Error From : " + serverListPath, err);
            }
        }
Esempio n. 2
0
 internal void RegistViewSession(ViewSession session)
 {
     using (lock_rw.EnterWrite())
     {
         var group = groupSessionsMap.GetOrAdd(session.ServerGroupID, (g) => new HashMap <string, ViewSession>());
         group[session.ServiceID]       = session;
         sessionsMap[session.ServiceID] = session;
     }
 }
Esempio n. 3
0
 public void Connect(string connectionId, string userId)
 {
     using (_readerWriterLock.EnterWrite())
     {
         HashSet <string> connectionIds;
         if (!_userToConnectionsMap.TryGetValue(userId, out connectionIds))
         {
             connectionIds = new HashSet <string>();
             _userToConnectionsMap[userId] = connectionIds;
         }
         connectionIds.Add(connectionId);
         _connectionToUserMap[connectionId] = userId;
     }
 }