diff --git a/server/hallserver/player/player.go b/server/hallserver/player/player.go index 3b661b33..5d676e4b 100644 --- a/server/hallserver/player/player.go +++ b/server/hallserver/player/player.go @@ -5,6 +5,7 @@ import ( "f5" "github.com/golang/protobuf/proto" "main/common" + . "main/global" ) type Player struct { @@ -20,7 +21,7 @@ func (this *Player) GetAccountId() string { } func (this *Player) SendMsg(rspMsg proto.Message) { - //wspListener.sendProxyMsg(this.socket.Conn, this.socket.SocketHandle, rspMsg) + GetWspListener().SendProxyMsg(this.socket.Conn, this.socket.SocketHandle, rspMsg) } func (this *Player) GetRoom() *common.Room { diff --git a/server/hallserver/player/playermgr.go b/server/hallserver/player/playermgr.go index bb076d53..ee56a6e5 100644 --- a/server/hallserver/player/playermgr.go +++ b/server/hallserver/player/playermgr.go @@ -8,6 +8,7 @@ import ( "mt" "q5" "main/constant" + "github.com/golang/protobuf/proto" ) type playerMgr struct { @@ -37,6 +38,14 @@ func (this *playerMgr) UnInit() { } func (this *playerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) { + oldPlayer := this.getPlayerBySocket(hdr.GetSocket()) + if oldPlayer != nil { + rspMsg := cs.SMLogin{} + rspMsg.Errcode = proto.Int32(0) + rspMsg.Errmsg = proto.String("") + oldPlayer.SendMsg(&rspMsg) + return; + } params := map[string]string{ "c": "User", "a": "info", @@ -86,7 +95,6 @@ func (this *playerMgr) CMLoginResult(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.Htt serverInfo := "192.168.100.39:2000" rspMsg := &cs.SMLogin{} rspMsg.ServerInfo = &serverInfo - rspMsg.AccountId = &resObj.Info.AccountID //wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg) } diff --git a/server/hallserver/proto/cs_proto.proto b/server/hallserver/proto/cs_proto.proto index b53da1fb..394c9dab 100644 --- a/server/hallserver/proto/cs_proto.proto +++ b/server/hallserver/proto/cs_proto.proto @@ -89,13 +89,15 @@ message CMLogin optional string account_id = 3; //账号id optional int32 proto_version = 5; //协议版本号Constant_e.ProtoVersion optional string session_id = 20; //账号id + optional int32 zone_id = 21; //国家Id } //登录回复 message SMLogin { - optional string server_info = 1; //服务器信息(重连时使用) - optional string account_id = 2; + optional int32 errcode = 7; //错误码 0:成功 1:重连失败 + optional string errmsg = 10; //错误描述 + optional string server_info = 9; //服务器信息(重连时使用) } //断线重连