Documentation ¶
Index ¶
- func CreateNewUID() (uint64, error)
- func GetValidSrvPort(minPort, maxPort int) string
- func NewServer(srvType uint8, srvID uint64, addr string, outerAddr string, fps int, ...) iserver.IServer
- type IDFetcher
- type IServerCtrl
- type Server
- func (srv *Server) Close()
- func (srv *Server) ConfigHTTPAdmin(addr string, port uint64, admin string)
- func (srv *Server) GetEntities(cellID uint64) iserver.IEntities
- func (srv *Server) GetFrameDeltaTime() time.Duration
- func (srv *Server) GetLoad() int
- func (srv *Server) GetStartupTime() time.Time
- func (srv *Server) HandleCommand(c []string) *admin.CmdResp
- func (srv *Server) HandlerSrvInvalid(entityID uint64)
- func (srv *Server) IsSrvValid() bool
- func (srv *Server) MainLoop()
- func (srv *Server) OnServerConnect(srvID uint64, serverType uint8)
- func (srv *Server) Run()
- type SrvNet
- func (srv *SrvNet) GetCurSrvInfo() *iserver.ServerInfo
- func (srv *SrvNet) GetSrvAddr() string
- func (srv *SrvNet) GetSrvID() uint64
- func (srv *SrvNet) GetSrvIDBySrvType(srvType uint8) (uint64, error)
- func (srv *SrvNet) GetSrvType() uint8
- func (srv *SrvNet) GetToken() string
- func (srv *SrvNet) MainLoop()
- func (srv *SrvNet) MsgProc_ClientVertifySucceedRet(content msgdef.IMsg)
- func (srv *SrvNet) MsgProc_SessClosed(content interface{})
- func (srv *SrvNet) MsgProc_SessVertified(content interface{})
- func (srv *SrvNet) PostMsgToCell(srvID uint64, cellID uint64, msg msgdef.IMsg) error
- func (srv *SrvNet) PostMsgToSrv(srvID uint64, msg msgdef.IMsg) error
- func (srv *SrvNet) RefreshSrvInfo()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValidSrvPort ¶
GetValidSrvPort 根据传入的最小端口和最大端口号,找一个可用端口,返回一个可用来绑定的地址
Types ¶
type IDFetcher ¶
type IDFetcher struct {
// contains filtered or unexported fields
}
IDFetcher 获取唯一的TempID号
type IServerCtrl ¶
type IServerCtrl interface { Init() error MainLoop() Destroy() GetLoad() int OnServerConnect(srvID uint64, serverType uint8) GetEntities(cellID uint64) iserver.IEntities }
IServerCtrl 后代服务器类需要继承的接口
type Server ¶
type Server struct { *SrvNet *serverMgr.LoadUpdater *entity.ProtoType *entity.Entities *IDFetcher // contains filtered or unexported fields }
Server 服务器
func (*Server) ConfigHTTPAdmin ¶
ConfigHTTPAdmin 配置控制台相关
func (*Server) GetFrameDeltaTime ¶
GetFrameDeltaTime 获取每帧间的间隔
func (*Server) GetStartupTime ¶
GetStartupTime 获取服务器启动时间
func (*Server) HandleCommand ¶
HandleCommand 控制台接口
func (*Server) HandlerSrvInvalid ¶
HandlerSrvInvalid 处理服务不可用
func (*Server) OnServerConnect ¶
type SrvNet ¶
type SrvNet struct {
// contains filtered or unexported fields
}
SrvNet 建立一个服务器的网关结构
func (*SrvNet) GetCurSrvInfo ¶
func (srv *SrvNet) GetCurSrvInfo() *iserver.ServerInfo
GetSrvInfo 获取服务器信息
func (*SrvNet) GetSrvIDBySrvType ¶
GetSrvIDBySrvType 获取一个SrvID
func (*SrvNet) MsgProc_ClientVertifySucceedRet ¶
MsgProc_ClientVertifySucceedRet 连入其它服务器
func (*SrvNet) MsgProc_SessClosed ¶
func (srv *SrvNet) MsgProc_SessClosed(content interface{})
MsgProc_SessClosed 会话关闭
func (*SrvNet) MsgProc_SessVertified ¶
func (srv *SrvNet) MsgProc_SessVertified(content interface{})
MsgProc_SessVertified 连接已经验证通过
func (*SrvNet) PostMsgToCell ¶
PostMsgToCell 将消息投递给某个Cell
func (*SrvNet) PostMsgToSrv ¶
PostMsgToSrv 根据srvID号把消息投递到相应的服务器上
func (*SrvNet) RefreshSrvInfo ¶
func (srv *SrvNet) RefreshSrvInfo()
RefreshSrvInfo 刷新当前服务器信息, 最多一秒钟调用一次, 防止服务器同时拉起时大量重复请求
Click to show internal directories.
Click to hide internal directories.