示例#1
0
        private void LoadAllInfo(Stream stream)
        {
            IList <HandleInfo> s = new List <HandleInfo>();

            if (!HandleInfo.Fill(s, stream))
            {
                this.socket.Abort();
                return;
            }
            MalockTable malock = this.engine.GetTable();

            lock (malock.GetSynchronizationObject())
            {
                foreach (HandleInfo i in s)
                {
                    if (i.Available)
                    {
                        malock.Exit(i.Key);
                    }
                    else
                    {
                        malock.Enter(i.Key, i.Identity);
                    }
                }
            }
        }
示例#2
0
 private void ProcessServer(MalockSocket socket, MalockNodeMessage message)
 {
     if (message.Command == MalockNodeMessage.SERVER_COMMAND_SYN_ENTER)
     {
         socket.UserToken = message;
         MalockTable malock = this.malockEngine.GetTable();
         malock.Enter(message.Key, message.Identity);
     }
     else if (message.Command == MalockNodeMessage.SERVER_COMMAND_SYN_EXIT)
     {
         MalockTable malock = this.malockEngine.GetTable();
         malock.Exit(message.Key, message.Identity);
         do
         {
             this.malockEngine.AckPipelineExit(new MalockTaskInfo()
             {
                 Key      = message.Key,
                 Identity = message.Identity,
             });
         } while (false);
     }
     else if (message.Command == MalockNodeMessage.SERVER_COMMAND_SYN_FREE)
     {
         string[]    keys;
         MalockTable malock = this.malockEngine.GetTable();
         malock.Exit(message.Identity, out keys);
         this.malockEngine.AckPipelineEnter(message.Identity, keys);
     }
     else if (message.Command == MalockNodeMessage.SERVER_COMMAND_SYN_LOADALLINFO)
     {
         this.malockEngine.GetAllInfo(new MalockTaskInfo()
         {
             Identity = socket.Identity,
             Socket   = socket,
             Timeout  = -1,
             Type     = MalockTaskType.kGetAllInfo
         });
     }
 }
示例#3
0
        private void Enter(MalockNodeMessage message)
        {
            MalockTable malock = this.engine.GetTable();

            malock.Enter(message.Key, message.Identity);
        }