娃娃机调转方向
This commit is contained in:
parent
72edbbdd4b
commit
7668ddcd93
|
@ -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