예제 #1
0
        private void ReplyClose(IUserToken ut, QueueResult data)
        {
            var qcoder = (QUnpacker)ut.Unpacker;

            _serverSokcet.Send(ut.ID, qcoder.QueueCoder.Close(data.Name));
            _exchange.Clear(ut.ID);
            _serverSokcet.Disconnecte(ut.ID);
        }
예제 #2
0
 public void Disconnect(string sessionID)
 {
     try
     {
         // _server.Disconnecte(_server.GetCurrentObj(sessionID));
         _server.Disconnecte(sessionID);
     }
     catch (Exception ex)
     {
         log4j.Error(sessionID, ex);
     }
     finally
     {
         ushort index = sessionIDToNumber.Get(sessionID);
         sessionIDToNumber.Remove(sessionID);
     }
 }
예제 #3
0
 public void Disconnecte(IUserToken userToken)
 {
     _serverSokcet.Disconnecte(userToken);
 }
예제 #4
0
파일: RServer.cs 프로젝트: mingyaaaa/SAEA
 internal void Disconnect(IUserToken userToken)
 {
     _server.Disconnecte(userToken.ID);
 }
예제 #5
0
        private void _server_OnReceive(object currentObj, byte[] data)
        {
            var mUserToken = (MessageUserToken)currentObj;

            mUserToken.Unpacker.Unpack(data, (s) =>
            {
                if (s.Content != null)
                {
                    try
                    {
                        var cm = SerializeHelper.PBDeserialize <ChatMessage>(s.Content);

                        switch (cm.Type)
                        {
                        case ChatMessageType.Login:
                            ReplyLogin(mUserToken, cm);
                            break;

                        case ChatMessageType.Subscribe:
                            ReplySubscribe(mUserToken, cm);
                            break;

                        case ChatMessageType.UnSubscribe:
                            ReplyUnsubscribe(mUserToken, cm);
                            break;

                        case ChatMessageType.ChannelMessage:
                            ReplyChannelMessage(mUserToken, cm);
                            break;

                        case ChatMessageType.PrivateMessage:
                            ReplyPrivateMessage(mUserToken, cm);
                            break;

                        case ChatMessageType.CreateGroup:
                            ReplyCreateGroup(mUserToken, cm);
                            break;

                        case ChatMessageType.AddMember:
                            ReplyAddMember(mUserToken, cm);
                            break;

                        case ChatMessageType.RemoveMember:
                            ReplyRemoveMember(mUserToken, cm);
                            break;

                        case ChatMessageType.RemoveGroup:
                            ReplyRemoveGroup(mUserToken, cm);
                            break;

                        case ChatMessageType.GroupMessage:
                            ReplyGroupMessage(mUserToken, cm);
                            break;

                        default:
                            throw new Exception("未知的协议");
                        }
                    }
                    catch (Exception ex)
                    {
                        _server.Disconnecte(currentObj);
                        LogHelper.Error("MessageServer._server_OnReceive", ex);
                    }
                }
            }, null, null);
        }
예제 #6
0
 /// <summary>
 /// 发送关闭
 /// </summary>
 /// <param name="id"></param>
 /// <param name="data"></param>
 public void Disconnect(string id, WSProtocal data)
 {
     ReplyBase(id, data);
     _server.Disconnecte(id);
 }