重构
This commit is contained in:
25
core/heart_beat/heart_beat.go
Normal file
25
core/heart_beat/heart_beat.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package heartbeat
|
||||
|
||||
import (
|
||||
"github.com/aceld/zinx/ziface"
|
||||
"github.com/aceld/zinx/zlog"
|
||||
)
|
||||
|
||||
var HeadBeatMsgID uint32 = 255
|
||||
|
||||
// MyHeartBeatMsg 用户自定义的心跳检测消息处理方法
|
||||
func MyHeartBeatMsg(conn ziface.IConnection) []byte {
|
||||
return []byte("heartbeat, I am server, I am alive")
|
||||
}
|
||||
|
||||
// MyHeartBeat 用户自定义心跳发送函数
|
||||
func MyHeartBeat(conn ziface.IConnection) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MyOnRemoteNotAlive 用户自定义的远程连接不存活时的处理方法
|
||||
func MyOnRemoteNotAlive(conn ziface.IConnection) {
|
||||
zlog.Ins().ErrorF("myOnRemoteNotAlive is Called, connID=%v", conn.GetConnID(), "remoteAddr =%v ", conn.RemoteAddr())
|
||||
//关闭链接
|
||||
conn.Stop()
|
||||
}
|
||||
Reference in New Issue
Block a user