This commit is contained in:
aozhiwei 2024-03-21 17:09:34 +08:00
parent d917c28547
commit 14d9884bba
5 changed files with 21 additions and 18 deletions

View File

@ -33,7 +33,6 @@ type LoginRsp struct {
type WspListener interface {
ProcessSSMMsg(*ss.SsNetMsgHandler, *f5.MsgHdr)
SendProxyMsg(net.Conn, uint16, proto.Message)
SendProxyErrMsg(net.Conn, uint16, proto.Message, int32, string)
}
type App interface {

View File

@ -10,6 +10,12 @@ type CsNetMsgHandler f5.NetMsgHandler[MsgHandler];
type MsgHandlerImpl struct {
}
func (this *SMLogin) Err(errCode int32, errMsg string) *SMLogin {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return nil
}
var handlers [2000]*CsNetMsgHandler
func GetNetMsgHandler(msgId uint16) *CsNetMsgHandler {
@ -979,4 +985,4 @@ func init() {
},
}
}
}

View File

@ -180,8 +180,3 @@ func (this *WSPListener) SendProxyMsg(conn net.Conn, socketHandle uint16, msg pr
copy(buff[f5.WSPROXYPACKHEAD_S_SIZE:], msgData[:])
conn.Write(buff)
}
func (this *WSPListener) SendProxyErrMsg(conn net.Conn, socketHandle, uint16, msg proto.Message,
errCode int32, errMsg string) {
}

View File

@ -137,22 +137,25 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, reqId int64,
rspMsg := cs.SMLogin{}
if rsp.GetErr() != nil {
GetWspListener().SendProxyErrMsg(pendingReq.hdr.Conn, pendingReq.hdr.SocketHandle, &rspMsg,
2,
"server internal error")
GetWspListener().SendProxyMsg(pendingReq.hdr.Conn, pendingReq.hdr.SocketHandle,
rspMsg.Err(
2,
"server internal error"))
f5.GetSysLog().Info("Api服务器JSON 解析错误1\n")
return
}
if !rsp.JsonParseOk() {
GetWspListener().SendProxyErrMsg(pendingReq.hdr.Conn, pendingReq.hdr.SocketHandle, &rspMsg,
2,
"server internal error")
GetWspListener().SendProxyMsg(pendingReq.hdr.Conn, pendingReq.hdr.SocketHandle,
rspMsg.Err(
2,
"server internal error"))
return
}
if rspObj.Errcode != 0 {
GetWspListener().SendProxyErrMsg(pendingReq.hdr.Conn, pendingReq.hdr.SocketHandle, &rspMsg,
1,
"invalid session_id")
GetWspListener().SendProxyMsg(pendingReq.hdr.Conn, pendingReq.hdr.SocketHandle,
rspMsg.Err(
2,
"invalid session_id"))
f5.GetSysLog().Error("Api服务器errcode:%d", rspObj.Errcode)
return
}

View File

@ -24,9 +24,9 @@ type pendingLoginRequest struct {
type playerMgr struct {
cs.MsgHandlerImpl
socketHash map[f5.WspCliConn]*player
socketHash map[f5.WspCliConn]*player
pendingLoginHash map[string]*pendingLoginRequest
currReqId int64
currReqId int64
}
func (this *playerMgr) Init() {