Compare commits
2 Commits
a314c42d6c
...
7668ddcd93
Author | SHA1 | Date |
---|---|---|
|
7668ddcd93 | |
|
72edbbdd4b |
|
@ -285,7 +285,6 @@ func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interf
|
|||
msg.Data = append(msg.Data, info)
|
||||
}
|
||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg)
|
||||
machinedoll.MachineMgr.BeatStatus = true
|
||||
fmt.Println("向游戏服务器发送娃娃机连接信息:%v", msg)
|
||||
return nil
|
||||
}
|
||||
|
@ -335,10 +334,6 @@ func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interf
|
|||
*/
|
||||
func SMDollMachineHeartBeatHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||
//fmt.Println("收到返回的心跳包")
|
||||
machinedoll.MachineMgr.BeatCount--
|
||||
if machinedoll.MachineMgr.BeatCount < 0 {
|
||||
machinedoll.MachineMgr.BeatCount = 0
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func init() {
|
||||
|
|
|
@ -133,48 +133,6 @@ func (this *MachineManager) Update() {
|
|||
pack := &machine.MSDollMachineHeartBeat{}
|
||||
pack.TimeStamp = time.Now().UnixMilli()
|
||||
SendToGameServer(int(machine.DollMachinePacketID_Packet_MSDollMachineHeartBeat), pack)
|
||||
/* var delConn []*Conn
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
for _, v := range this.ConnMap {
|
||||
_, err := v.Write([]byte("heartbeat"))
|
||||
if err != nil {
|
||||
delConn = append(delConn, v)
|
||||
v.Close()
|
||||
fmt.Println("断开连接:%v", v.Addr)
|
||||
this.UpdateToGameServer(v, 0)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||
for _, v := range delConn {
|
||||
delete(this.ConnMap, v.Id)
|
||||
this.DelConnMap[v.Id] = v.Addr
|
||||
}
|
||||
|
||||
// 重连
|
||||
var delIds []*Conn
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
for id, addr := range this.DelConnMap {
|
||||
conn, err := net.DialTimeout("tcp", addr, 5*time.Second)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
fmt.Println("娃娃机重连成功!addr = %v", addr)
|
||||
delIds = append(delIds, &Conn{
|
||||
Id: id,
|
||||
Conn: conn,
|
||||
Addr: addr,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||
for _, v := range delIds {
|
||||
this.ConnMap[v.Id] = v
|
||||
delete(this.DelConnMap, v.Id)
|
||||
this.UpdateToGameServer(v, 1)
|
||||
}
|
||||
})).StartByFixExecutor(this.ModuleName())
|
||||
})).StartByFixExecutor(this.ModuleName())*/
|
||||
}
|
||||
|
||||
func (this *MachineManager) Shutdown() {
|
||||
|
|
Loading…
Reference in New Issue