parent
f7a9ab3be1
commit
7a5bb87b9e
@ -1,7 +1,6 @@
|
|||||||
package game
|
package game
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"server/GoUtil"
|
"server/GoUtil"
|
||||||
"server/MergeConst"
|
"server/MergeConst"
|
||||||
@ -49,23 +48,8 @@ func HandleAdminReq(args []interface{}) {
|
|||||||
// log.Debug("admin 消息Func : %s", m.GetFunc())
|
// log.Debug("admin 消息Func : %s", m.GetFunc())
|
||||||
AdminProcess(m.GetFunc(), []interface{}{a, buf})
|
AdminProcess(m.GetFunc(), []interface{}{a, buf})
|
||||||
}
|
}
|
||||||
func HandleClientReq(args []interface{}) {
|
|
||||||
// log.Debug("HandleClientReq")
|
|
||||||
// 创建一个带有超时的上下文
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
done := make(chan struct{})
|
func HandleClientReq(args []interface{}) {
|
||||||
go HandleClientReqProcess(args)
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
m := args[0].(*msg.ClientReq)
|
|
||||||
log.Debug("HandleClientReq func %s timed out", m.GetFunc())
|
|
||||||
case <-done:
|
|
||||||
log.Debug("HandleClientReq completed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func HandleClientReqProcess(args []interface{}) {
|
|
||||||
if G_GameLogicPtr.SeverInfo.Status == SERVER_STATUS_CLOSE || G_GameLogicPtr.SeverInfo.Status == SERVER_STATUS_MAINTAIN {
|
if G_GameLogicPtr.SeverInfo.Status == SERVER_STATUS_CLOSE || G_GameLogicPtr.SeverInfo.Status == SERVER_STATUS_MAINTAIN {
|
||||||
return // 服务器关闭或者维护中,不处理任何消息
|
return // 服务器关闭或者维护中,不处理任何消息
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user