| | |
| | | import GMShell
|
| | |
|
| | | import traceback
|
| | | import json
|
| | | import cPickle
|
| | |
|
| | | def SendMsgToCrossServer(msgType, dataMsg):
|
| | | ## 发送信息到跨服服务器上
|
| | |
| | | return
|
| | | if not dataMsg:
|
| | | return
|
| | | sendMsg = json.dumps({"MsgType":msgType, "Data":dataMsg, "ServerGroupID":GameWorld.GetServerGroupID()}, ensure_ascii=False)
|
| | | |
| | | # 协议要用最高级2,可减少长度
|
| | | sendMsg = cPickle.dumps({"MsgType":msgType, "Data":dataMsg, "ServerGroupID":GameWorld.GetServerGroupID()}, 2)
|
| | | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
|
| | | GameWorld.ErrLog("服务器未启动好,不允许向跨服服务器发送数据! %s" % (sendMsg))
|
| | | return
|
| | |
| | | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
|
| | | GameWorld.Log("服务器未启动好,不处理子服信息!")
|
| | | return
|
| | | msgDict = json.loads(recvMsg)
|
| | | msgDict = cPickle.loads(recvMsg)
|
| | |
|
| | | msgType = msgDict.get("MsgType", -1)
|
| | | msgData = msgDict.get("Data", "")
|
| | |
| | | return
|
| | | if not dataMsg:
|
| | | return
|
| | | sendMsg = json.dumps({"MsgType":msgType, "Data":dataMsg}, ensure_ascii=False)
|
| | | sendMsg = cPickle.dumps({"MsgType":msgType, "Data":dataMsg}, 2)
|
| | | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
|
| | | GameWorld.ErrLog("跨服服务器未启动好,不允许向子服发送数据! serverGroupIDList=%s, sendMsg=%s" % (serverGroupIDList, sendMsg))
|
| | | return
|
| | |
| | | serverGroupIDList = list(set(serverGroupIDList)) # 去重
|
| | | #for serverGroupID in serverGroupIDList:
|
| | | # GameWorld.GetGameWorld().SendMergeMsgToClientByGroupID(serverGroupID, sendMsg)
|
| | | jsonGroupIDInfo = json.dumps(serverGroupIDList, ensure_ascii=False)
|
| | | jsonGroupIDInfo = cPickle.dumps(serverGroupIDList, 2)
|
| | | GameWorld.GetGameWorld().SendMergeMsgToClientByGroupList(jsonGroupIDInfo, sendMsg)
|
| | | return
|
| | |
|
| | |
| | | GameWorld.Log("服务器未启动好,不处理跨服信息!")
|
| | | return
|
| | |
|
| | | msgDict = json.loads(dataMsg)
|
| | | msgDict = cPickle.loads(dataMsg)
|
| | | msgType = msgDict.get("MsgType", -1)
|
| | | msgData = msgDict.get("Data", "")
|
| | |
|