You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
668 B

  1. package ziface
  2. //定义服务器接口
  3. type IServer interface{
  4. //启动服务器方法
  5. Start()
  6. //停止服务器方法
  7. Stop()
  8. //开启业务服务方法
  9. Serve()
  10. //路由功能:给当前服务注册一个路由业务方法,供客户端链接处理使用
  11. AddRouter(msgId uint32, router IRouter)
  12. //得到链接管理
  13. GetConnMgr() IConnManager
  14. //设置该Server的连接创建时Hook函数
  15. SetOnConnStart(func (IConnection))
  16. //设置该Server的连接断开时的Hook函数
  17. SetOnConnStop(func (IConnection))
  18. //调用连接OnConnStart Hook函数
  19. CallOnConnStart(conn IConnection)
  20. //调用连接OnConnStop Hook函数
  21. CallOnConnStop(conn IConnection)
  22. }