review
This commit is contained in:
parent
96bbac8533
commit
fe8ccec885
|
@ -0,0 +1,45 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
rawproto "google.golang.org/protobuf/proto"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
"mongo.games.com/goserver/srvlib"
|
||||||
|
"mongo.games.com/goserver/srvlib/protocol"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RegisterBoardCastHandler() {
|
||||||
|
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &protocol.SSPacketBroadcast{}, BroadcastHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BroadcastHandler(s *netlib.Session, packetId int, data interface{}) error {
|
||||||
|
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||||
|
pd := bp.GetData()
|
||||||
|
sp := bp.GetSessParam()
|
||||||
|
if bcss := sp.GetBcss(); bcss != nil {
|
||||||
|
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetId int, data interface{}) (rawproto.Message, error) {
|
||||||
|
pack := &protocol.SSPacketBroadcast{
|
||||||
|
SessParam: sp,
|
||||||
|
PacketId: proto.Int(packetId),
|
||||||
|
}
|
||||||
|
|
||||||
|
if byteData, ok := data.([]byte); ok {
|
||||||
|
pack.Data = byteData
|
||||||
|
} else {
|
||||||
|
byteData, err := netlib.MarshalPacket(packetId, data)
|
||||||
|
if err == nil {
|
||||||
|
pack.Data = byteData
|
||||||
|
} else {
|
||||||
|
logger.Logger.Warnf("CreateBroadcastPacket err:%v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pack, nil
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
rawproto "google.golang.org/protobuf/proto"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
"mongo.games.com/goserver/srvlib"
|
||||||
|
"mongo.games.com/goserver/srvlib/protocol"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RegisterMulticastHandler() {
|
||||||
|
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &protocol.SSPacketMulticast{}, MulticastHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MulticastHandler(s *netlib.Session, packetId int, data interface{}) error {
|
||||||
|
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||||
|
pd := mp.GetData()
|
||||||
|
sis := mp.GetSessions()
|
||||||
|
for _, si := range sis {
|
||||||
|
ss := si.GetMcss()
|
||||||
|
if ss != nil {
|
||||||
|
ns := srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
||||||
|
if ns != nil {
|
||||||
|
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateMulticastPacket(packetId int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
||||||
|
pack := &protocol.SSPacketMulticast{
|
||||||
|
Sessions: sis,
|
||||||
|
PacketId: proto.Int(packetId),
|
||||||
|
}
|
||||||
|
if byteData, ok := data.([]byte); ok {
|
||||||
|
pack.Data = byteData
|
||||||
|
} else {
|
||||||
|
byteData, err := netlib.MarshalPacket(packetId, data)
|
||||||
|
if err == nil {
|
||||||
|
pack.Data = byteData
|
||||||
|
} else {
|
||||||
|
logger.Logger.Errorf("CreateMulticastPacket err:%v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pack, nil
|
||||||
|
}
|
|
@ -576,6 +576,7 @@ func init() {
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
common.RegisterMulticastHandler()
|
||||||
//玩家离开
|
//玩家离开
|
||||||
netlib.Register(int(server.SSPacketID_PACKET_WG_PlayerLEAVE), server.WGPlayerLeave{}, HandleWGPlayerLeave)
|
netlib.Register(int(server.SSPacketID_PACKET_WG_PlayerLEAVE), server.WGPlayerLeave{}, HandleWGPlayerLeave)
|
||||||
//同步记牌器过期时间
|
//同步记牌器过期时间
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
package base
|
|
||||||
|
|
||||||
import (
|
|
||||||
rawproto "google.golang.org/protobuf/proto"
|
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
|
||||||
"mongo.games.com/goserver/srvlib"
|
|
||||||
"mongo.games.com/goserver/srvlib/protocol"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
BroadcastMaker = &BroadcastPacketFactory{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type BroadcastPacketFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type BroadcastHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
|
||||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
|
||||||
pack := &protocol.SSPacketBroadcast{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
|
||||||
pack := &protocol.SSPacketBroadcast{
|
|
||||||
SessParam: sp,
|
|
||||||
PacketId: proto.Int(packetid),
|
|
||||||
}
|
|
||||||
if byteData, ok := data.([]byte); ok {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
|
||||||
if err == nil {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proto.SetDefaults(pack)
|
|
||||||
return pack, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
|
||||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
|
||||||
pd := bp.GetData()
|
|
||||||
sp := bp.GetSessParam()
|
|
||||||
if bcss := sp.GetBcss(); bcss != nil {
|
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
package base
|
|
||||||
|
|
||||||
import (
|
|
||||||
rawproto "google.golang.org/protobuf/proto"
|
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
|
||||||
"mongo.games.com/goserver/srvlib"
|
|
||||||
"mongo.games.com/goserver/srvlib/protocol"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
MulticastMaker = &MulticastPacketFactory{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type MulticastPacketFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type MulticastHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &MulticastHandler{})
|
|
||||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), MulticastMaker)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastPacketFactory) CreatePacket() interface{} {
|
|
||||||
pack := &protocol.SSPacketMulticast{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastPacketFactory) CreateMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
|
||||||
pack := &protocol.SSPacketMulticast{
|
|
||||||
Sessions: sis,
|
|
||||||
PacketId: proto.Int(packetid),
|
|
||||||
}
|
|
||||||
if byteData, ok := data.([]byte); ok {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
|
||||||
if err == nil {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
logger.Logger.Info("MulticastPacketFactory.CreateMulticastPacket err:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proto.SetDefaults(pack)
|
|
||||||
return pack, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
|
||||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
|
||||||
pd := mp.GetData()
|
|
||||||
sis := mp.GetSessions()
|
|
||||||
for _, si := range sis {
|
|
||||||
ss := si.GetMcss()
|
|
||||||
if ss != nil {
|
|
||||||
ns := srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
|
||||||
if ns != nil {
|
|
||||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -158,7 +158,7 @@ func (this *PlayerMgr) BroadcastMessage(packetid int, rawpack interface{}) bool
|
||||||
sc := &protocol.BCSessionUnion{
|
sc := &protocol.BCSessionUnion{
|
||||||
Bccs: &protocol.BCClientSession{},
|
Bccs: &protocol.BCClientSession{},
|
||||||
}
|
}
|
||||||
pack, err := BroadcastMaker.CreateBroadcastPacket(sc, packetid, rawpack)
|
pack, err := common.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||||
if err == nil && pack != nil {
|
if err == nil && pack != nil {
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
srvlib.ServerSessionMgrSington.Broadcast(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -893,7 +893,7 @@ func (this *Scene) Broadcast(packetid int, msg rawproto.Message, excludeSid int6
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
@ -917,7 +917,7 @@ func (this *Scene) RobotBroadcast(packetid int, msg rawproto.Message) {
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
@ -941,7 +941,7 @@ func (this *Scene) BroadcastToAudience(packetid int, msg rawproto.Message) {
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
|
|
@ -195,7 +195,7 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
|
||||||
|
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
cPack, err := MulticastMaker.CreateMulticastPacket(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, v...)
|
cPack, err := common.CreateMulticastPacket(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(cPack)
|
proto.SetDefaults(cPack)
|
||||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), cPack)
|
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), cPack)
|
||||||
|
|
|
@ -1458,7 +1458,7 @@ func (this *FishingSceneData) BroadCastMessage(packetid int, msg proto.Message,
|
||||||
if gateSess == nil || len(v) == 0 {
|
if gateSess == nil || len(v) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
pack, err := base.MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
|
|
@ -1,56 +1,16 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rawproto "google.golang.org/protobuf/proto"
|
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
"mongo.games.com/goserver/core/netlib"
|
||||||
"mongo.games.com/goserver/srvlib"
|
"mongo.games.com/goserver/srvlib"
|
||||||
"mongo.games.com/goserver/srvlib/protocol"
|
"mongo.games.com/goserver/srvlib/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
BroadcastMaker = &BroadcastPacketFactory{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type BroadcastPacketFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type BroadcastHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// 给所有玩家或某个类型的所有服务发消息
|
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &protocol.SSPacketBroadcast{}, BroadcastHandler)
|
||||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
|
||||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
func BroadcastHandler(s *netlib.Session, packetid int, data interface{}) error {
|
||||||
pack := &protocol.SSPacketBroadcast{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
|
||||||
pack := &protocol.SSPacketBroadcast{
|
|
||||||
SessParam: sp,
|
|
||||||
PacketId: proto.Int(packetid),
|
|
||||||
}
|
|
||||||
if byteData, ok := data.([]byte); ok {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
|
||||||
if err == nil {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proto.SetDefaults(pack)
|
|
||||||
return pack, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
|
||||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||||
pd := bp.GetData()
|
pd := bp.GetData()
|
||||||
sp := bp.GetSessParam()
|
sp := bp.GetSessParam()
|
||||||
|
|
|
@ -1,61 +1,21 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rawproto "google.golang.org/protobuf/proto"
|
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
"mongo.games.com/goserver/core/netlib"
|
||||||
"mongo.games.com/goserver/srvlib"
|
"mongo.games.com/goserver/srvlib"
|
||||||
"mongo.games.com/goserver/srvlib/protocol"
|
"mongo.games.com/goserver/srvlib/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
MulticastMaker = &MulticastPacketFactory{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type MulticastPacketFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type MulticastHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// 给某些玩家和某些服务发消息
|
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &protocol.SSPacketMulticast{}, MulticastHandler)
|
||||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &MulticastHandler{})
|
|
||||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), MulticastMaker)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MulticastPacketFactory) CreatePacket() interface{} {
|
func MulticastHandler(s *netlib.Session, packetid int, data interface{}) error {
|
||||||
pack := &protocol.SSPacketMulticast{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastPacketFactory) CreateMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
|
||||||
pack := &protocol.SSPacketMulticast{
|
|
||||||
Sessions: sis,
|
|
||||||
PacketId: proto.Int(packetid),
|
|
||||||
}
|
|
||||||
if byteData, ok := data.([]byte); ok {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
|
||||||
if err == nil {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
logger.Logger.Info("MulticastPacketFactory.CreateMulticastPacket err:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proto.SetDefaults(pack)
|
|
||||||
return pack, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
|
||||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||||
pd := mp.GetData()
|
pd := mp.GetData()
|
||||||
sis := mp.GetSessions()
|
sis := mp.GetSessions()
|
||||||
for _, si := range sis {
|
for _, si := range sis {
|
||||||
ns := this.getSession(si)
|
ns := getSession(si)
|
||||||
if ns != nil {
|
if ns != nil {
|
||||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +24,7 @@ func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data inte
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MulticastHandler) getSession(su *protocol.MCSessionUnion) *netlib.Session {
|
func getSession(su *protocol.MCSessionUnion) *netlib.Session {
|
||||||
cs := su.GetMccs()
|
cs := su.GetMccs()
|
||||||
if cs != nil {
|
if cs != nil {
|
||||||
return srvlib.ClientSessionMgrSington.GetSession(cs.GetSId())
|
return srvlib.ClientSessionMgrSington.GetSession(cs.GetSId())
|
||||||
|
|
|
@ -1,61 +1,9 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rawproto "google.golang.org/protobuf/proto"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
|
||||||
"mongo.games.com/goserver/srvlib"
|
|
||||||
"mongo.games.com/goserver/srvlib/protocol"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
BroadcastMaker = &BroadcastPacketFactory{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type BroadcastPacketFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type BroadcastHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
common.RegisterBoardCastHandler()
|
||||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
|
||||||
pack := &protocol.SSPacketBroadcast{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
|
||||||
pack := &protocol.SSPacketBroadcast{
|
|
||||||
SessParam: sp,
|
|
||||||
PacketId: proto.Int(packetid),
|
|
||||||
}
|
|
||||||
if byteData, ok := data.([]byte); ok {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
|
||||||
if err == nil {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proto.SetDefaults(pack)
|
|
||||||
return pack, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
|
||||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
|
||||||
pd := bp.GetData()
|
|
||||||
sp := bp.GetSessParam()
|
|
||||||
if bcss := sp.GetBcss(); bcss != nil {
|
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ func SrvCtrlNotice(rw http.ResponseWriter, data []byte) {
|
||||||
sc := &protocol.BCSessionUnion{
|
sc := &protocol.BCSessionUnion{
|
||||||
Bccs: &protocol.BCClientSession{},
|
Bccs: &protocol.BCClientSession{},
|
||||||
}
|
}
|
||||||
broadcast, err := BroadcastMaker.CreateBroadcastPacket(sc, int(msg_proto.MSGPacketID_PACKET_SC_NOTICE), noticePacket)
|
broadcast, err := common.CreateBroadcastPacket(sc, int(msg_proto.MSGPacketID_PACKET_SC_NOTICE), noticePacket)
|
||||||
if err != nil || broadcast == nil {
|
if err != nil || broadcast == nil {
|
||||||
pack.Tag = webapi.TagCode_FAILED
|
pack.Tag = webapi.TagCode_FAILED
|
||||||
pack.Msg = "send notice failed(inner error)"
|
pack.Msg = "send notice failed(inner error)"
|
||||||
|
|
|
@ -789,6 +789,9 @@ func (this *CSAccountInvalidHandler) Process(s *netlib.Session, packetid int, da
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
common.RegisterBoardCastHandler()
|
||||||
|
common.RegisterMulticastHandler()
|
||||||
|
|
||||||
common.RegisterHandler(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdHandler{})
|
common.RegisterHandler(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdHandler{})
|
||||||
netlib.RegisterFactory(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdPacketFactory{})
|
netlib.RegisterFactory(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdPacketFactory{})
|
||||||
|
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
rawproto "google.golang.org/protobuf/proto"
|
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
|
||||||
"mongo.games.com/goserver/srvlib"
|
|
||||||
"mongo.games.com/goserver/srvlib/protocol"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
BroadcastMaker = &BroadcastPacketFactory{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type BroadcastPacketFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type BroadcastHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
|
||||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
|
||||||
pack := &protocol.SSPacketBroadcast{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
|
||||||
pack := &protocol.SSPacketBroadcast{
|
|
||||||
SessParam: sp,
|
|
||||||
PacketId: proto.Int(packetid),
|
|
||||||
}
|
|
||||||
|
|
||||||
if byteData, ok := data.([]byte); ok {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
|
||||||
if err == nil {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proto.SetDefaults(pack)
|
|
||||||
return pack, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
|
||||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
|
||||||
pd := bp.GetData()
|
|
||||||
sp := bp.GetSessParam()
|
|
||||||
if bcss := sp.GetBcss(); bcss != nil {
|
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -75,7 +75,7 @@ func (gsm *GameStateManager) BrodcastGameState(gameId int32, platform string, pa
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packid, pack, v...)
|
pack, err := common.CreateMulticastPacket(packid, pack, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
rawproto "google.golang.org/protobuf/proto"
|
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
|
||||||
"mongo.games.com/goserver/srvlib"
|
|
||||||
"mongo.games.com/goserver/srvlib/protocol"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
MulticastMaker = &MulticastPacketFactory{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type MulticastPacketFactory struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type MulticastHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &MulticastHandler{})
|
|
||||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), MulticastMaker)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastPacketFactory) CreatePacket() interface{} {
|
|
||||||
pack := &protocol.SSPacketMulticast{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastPacketFactory) CreateMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
|
||||||
pack := &protocol.SSPacketMulticast{
|
|
||||||
Sessions: sis,
|
|
||||||
PacketId: proto.Int(packetid),
|
|
||||||
}
|
|
||||||
if byteData, ok := data.([]byte); ok {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
|
||||||
if err == nil {
|
|
||||||
pack.Data = byteData
|
|
||||||
} else {
|
|
||||||
logger.Logger.Info("MulticastPacketFactory.CreateMulticastPacket err:", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proto.SetDefaults(pack)
|
|
||||||
return pack, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
|
||||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
|
||||||
pd := mp.GetData()
|
|
||||||
sis := mp.GetSessions()
|
|
||||||
for _, si := range sis {
|
|
||||||
ss := si.GetMcss()
|
|
||||||
if ss != nil {
|
|
||||||
ns := srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
|
||||||
if ns != nil {
|
|
||||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"mongo.games.com/goserver/core/utils"
|
"mongo.games.com/goserver/core/utils"
|
||||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/proto"
|
"mongo.games.com/game/proto"
|
||||||
hallproto "mongo.games.com/game/protocol/gamehall"
|
hallproto "mongo.games.com/game/protocol/gamehall"
|
||||||
|
@ -302,7 +303,7 @@ func (pm *PlatformMgr) Broadcast(packetid int, packet interface{}, players map[i
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, packet, v...)
|
pack, err := common.CreateMulticastPacket(packetid, packet, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"mongo.games.com/game/worldsrv/internal"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/basic"
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
@ -16,7 +15,8 @@ import (
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/proto"
|
"mongo.games.com/game/proto"
|
||||||
server_proto "mongo.games.com/game/protocol/server"
|
serverproto "mongo.games.com/game/protocol/server"
|
||||||
|
"mongo.games.com/game/worldsrv/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var PlayerMgrSington = &PlayerMgr{
|
var PlayerMgrSington = &PlayerMgr{
|
||||||
|
@ -292,7 +292,7 @@ func (this *PlayerMgr) BroadcastMessage(packetid int, rawpack interface{}) bool
|
||||||
sc := &srvproto.BCSessionUnion{
|
sc := &srvproto.BCSessionUnion{
|
||||||
Bccs: &srvproto.BCClientSession{},
|
Bccs: &srvproto.BCClientSession{},
|
||||||
}
|
}
|
||||||
pack, err := BroadcastMaker.CreateBroadcastPacket(sc, packetid, rawpack)
|
pack, err := common.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||||
if err == nil && pack != nil {
|
if err == nil && pack != nil {
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(srvproto.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
srvlib.ServerSessionMgrSington.Broadcast(int(srvproto.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||||
return true
|
return true
|
||||||
|
@ -318,7 +318,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatform(platform string, packetid int,
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
@ -345,7 +345,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformByFunc(platform string, packeti
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
@ -378,7 +378,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformWithHall(platform string, snid
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
@ -391,7 +391,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformWithHall(platform string, snid
|
||||||
|
|
||||||
// BroadcastMessageToGroup 发送群组消息
|
// BroadcastMessageToGroup 发送群组消息
|
||||||
func (this *PlayerMgr) BroadcastMessageToGroup(packetid int, rawpack interface{}, tags []string) bool {
|
func (this *PlayerMgr) BroadcastMessageToGroup(packetid int, rawpack interface{}, tags []string) bool {
|
||||||
pack := &server_proto.SSCustomTagMulticast{
|
pack := &serverproto.SSCustomTagMulticast{
|
||||||
Tags: tags,
|
Tags: tags,
|
||||||
}
|
}
|
||||||
if byteData, ok := rawpack.([]byte); ok {
|
if byteData, ok := rawpack.([]byte); ok {
|
||||||
|
@ -405,7 +405,7 @@ func (this *PlayerMgr) BroadcastMessageToGroup(packetid int, rawpack interface{}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(server_proto.SSPacketID_PACKET_SS_CUSTOMTAG_MULTICAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
srvlib.ServerSessionMgrSington.Broadcast(int(serverproto.SSPacketID_PACKET_SS_CUSTOMTAG_MULTICAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ func (this *PlayerMgr) BroadcastMessageToTarget(platform string, target []int32,
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
|
|
@ -1159,7 +1159,7 @@ func (this *Scene) Broadcast(packetid int, msg rawproto.Message, excludeSid int6
|
||||||
|
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (tm *TmMatch) BroadcastMessage(packetId int, rawPack interface{}) {
|
||||||
}
|
}
|
||||||
for gateSess, v := range mgs {
|
for gateSess, v := range mgs {
|
||||||
if gateSess != nil && len(v) != 0 {
|
if gateSess != nil && len(v) != 0 {
|
||||||
pack, err := MulticastMaker.CreateMulticastPacket(packetId, rawPack, v...)
|
pack, err := common.CreateMulticastPacket(packetId, rawPack, v...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||||
|
|
Loading…
Reference in New Issue