This commit is contained in:
aozhiwei 2023-09-14 22:28:35 +08:00
parent 3d2b4cea64
commit 1ae2218a11
4 changed files with 40 additions and 46 deletions

View File

@ -44,32 +44,29 @@ func (this *app) UnInit() {
func (this *app) Update() {
this.netMsgQueue.Fetch()
for !this.netMsgQueue.WorkList.Empty() {
next := this.netMsgQueue.WorkList.Next()
hdr, ok := next.GetData().(*f5.MsgHdr)
if ok {
if hdr.MsgId < f5.WSP_SS_MAX_MSGID {
handler := ss.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case constant.WSP_LISTENER_HANDLER_ID:
GetWspListener().ProcessSSMMsg(handler, hdr)
}
hdr := this.netMsgQueue.WorkList.FirstEntry().(*f5.MsgHdr)
hdr.Entry.DelInit()
if hdr.MsgId < f5.WSP_SS_MAX_MSGID {
handler := ss.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case constant.WSP_LISTENER_HANDLER_ID:
GetWspListener().ProcessSSMMsg(handler, hdr)
}
} else {
handler := cs.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case constant.PLAYER_MGR_HANDLER_ID:
case constant.PLAYER_HANDLER_ID:
GetPlayerMgr().ProcessCMMsg(handler, hdr)
case constant.ROOM_HANDLER_ID:
case constant.ROOM_MGR_HANDLER_ID:
GetRoomMgr().ProcessCMMsg(handler, hdr)
}
}
} else {
handler := cs.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case constant.PLAYER_MGR_HANDLER_ID:
case constant.PLAYER_HANDLER_ID:
GetPlayerMgr().ProcessCMMsg(handler, hdr)
case constant.ROOM_HANDLER_ID:
case constant.ROOM_MGR_HANDLER_ID:
GetRoomMgr().ProcessCMMsg(handler, hdr)
}
}
}
next.Del()
}
}

View File

@ -41,33 +41,30 @@ func (this *App) UnInit() {
func (this *App) Update() {
this.netMsgQueue.Fetch()
for !this.netMsgQueue.WorkList.Empty() {
next := this.netMsgQueue.WorkList.Next()
hdr, ok := next.GetData().(*f5.MsgHdr)
if ok {
if hdr.MsgId < f5.WSP_SS_MAX_MSGID {
handler := ss.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case WSP_LISTENER_HANDLER_ID:
ss.DispatchMsg(handler, hdr, wspListener)
}
hdr := this.netMsgQueue.WorkList.FirstEntry().(*f5.MsgHdr)
hdr.Entry.DelInit()
if hdr.MsgId < f5.WSP_SS_MAX_MSGID {
handler := ss.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case WSP_LISTENER_HANDLER_ID:
ss.DispatchMsg(handler, hdr, wspListener)
}
} else {
handler := cs.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case PLAYER_MGR_HANDLER_ID:
cs.DispatchMsg(handler, hdr, playerMgr)
case PLAYER_HANDLER_ID:
player := playerMgr.getPlayerBySocket(hdr.GetSocket())
if player != nil {
cs.DispatchMsg(handler, hdr, player)
}
}
} else {
handler := cs.GetNetMsgHandler(hdr.MsgId)
if handler != nil {
switch handler.HandlerId {
case PLAYER_MGR_HANDLER_ID:
cs.DispatchMsg(handler, hdr, playerMgr)
case PLAYER_HANDLER_ID:
player := playerMgr.getPlayerBySocket(hdr.GetSocket())
if player != nil {
cs.DispatchMsg(handler, hdr, player)
}
}
}
}
next.Del()
}
}

2
third_party/f5 vendored

@ -1 +1 @@
Subproject commit b5f94d01cc2b8c45323c83febcd8343c850ca046
Subproject commit 47db6c9c60d59681e7fc02bd5649d7fe918b124e

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit fe65489de27eef96e2c1879cb19dd84ee172be9c
Subproject commit 37aba942375f8f8bd62c162aab4e93ca0b86aa6b