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() { func (this *app) Update() {
this.netMsgQueue.Fetch() this.netMsgQueue.Fetch()
for !this.netMsgQueue.WorkList.Empty() { for !this.netMsgQueue.WorkList.Empty() {
next := this.netMsgQueue.WorkList.Next() hdr := this.netMsgQueue.WorkList.FirstEntry().(*f5.MsgHdr)
hdr, ok := next.GetData().(*f5.MsgHdr) hdr.Entry.DelInit()
if ok { if hdr.MsgId < f5.WSP_SS_MAX_MSGID {
if hdr.MsgId < f5.WSP_SS_MAX_MSGID { handler := ss.GetNetMsgHandler(hdr.MsgId)
handler := ss.GetNetMsgHandler(hdr.MsgId) if handler != nil {
if handler != nil { switch handler.HandlerId {
switch handler.HandlerId { case constant.WSP_LISTENER_HANDLER_ID:
case constant.WSP_LISTENER_HANDLER_ID: GetWspListener().ProcessSSMMsg(handler, hdr)
GetWspListener().ProcessSSMMsg(handler, hdr)
}
} }
} else { }
handler := cs.GetNetMsgHandler(hdr.MsgId) } else {
if handler != nil { handler := cs.GetNetMsgHandler(hdr.MsgId)
switch handler.HandlerId { if handler != nil {
case constant.PLAYER_MGR_HANDLER_ID: switch handler.HandlerId {
case constant.PLAYER_HANDLER_ID: case constant.PLAYER_MGR_HANDLER_ID:
GetPlayerMgr().ProcessCMMsg(handler, hdr) case constant.PLAYER_HANDLER_ID:
case constant.ROOM_HANDLER_ID: GetPlayerMgr().ProcessCMMsg(handler, hdr)
case constant.ROOM_MGR_HANDLER_ID: case constant.ROOM_HANDLER_ID:
GetRoomMgr().ProcessCMMsg(handler, hdr) 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() { func (this *App) Update() {
this.netMsgQueue.Fetch() this.netMsgQueue.Fetch()
for !this.netMsgQueue.WorkList.Empty() { for !this.netMsgQueue.WorkList.Empty() {
next := this.netMsgQueue.WorkList.Next() hdr := this.netMsgQueue.WorkList.FirstEntry().(*f5.MsgHdr)
hdr, ok := next.GetData().(*f5.MsgHdr) hdr.Entry.DelInit()
if ok { if hdr.MsgId < f5.WSP_SS_MAX_MSGID {
if hdr.MsgId < f5.WSP_SS_MAX_MSGID { handler := ss.GetNetMsgHandler(hdr.MsgId)
handler := ss.GetNetMsgHandler(hdr.MsgId) if handler != nil {
if handler != nil { switch handler.HandlerId {
switch handler.HandlerId { case WSP_LISTENER_HANDLER_ID:
case WSP_LISTENER_HANDLER_ID: ss.DispatchMsg(handler, hdr, wspListener)
ss.DispatchMsg(handler, hdr, wspListener)
}
} }
} else { }
handler := cs.GetNetMsgHandler(hdr.MsgId) } else {
if handler != nil { handler := cs.GetNetMsgHandler(hdr.MsgId)
switch handler.HandlerId { if handler != nil {
case PLAYER_MGR_HANDLER_ID: switch handler.HandlerId {
cs.DispatchMsg(handler, hdr, playerMgr) case PLAYER_MGR_HANDLER_ID:
case PLAYER_HANDLER_ID: cs.DispatchMsg(handler, hdr, playerMgr)
player := playerMgr.getPlayerBySocket(hdr.GetSocket()) case PLAYER_HANDLER_ID:
if player != nil { player := playerMgr.getPlayerBySocket(hdr.GetSocket())
cs.DispatchMsg(handler, hdr, player) 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