nodenormal

package
v0.0.0-...-96491ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntranetSession

type IntranetSession struct {
	*nodecommon.SessionBase
	// contains filtered or unexported fields
}

IntranetSession : 网络会话类( 服务器组内 Gateway 客户端会话类 )

func NewIntranetSession

func NewIntranetSession(ctx *common.Context, sessMgr *nodecommon.SessionMgr, sourceSess *Session) *IntranetSession

NewIntranetSession : 网络会话类的构造函数

func (*IntranetSession) DoClose

func (sess *IntranetSession) DoClose(sessbase *nodecommon.SessionBase)

DoClose : 节点关闭时处理

func (*IntranetSession) DoLose

func (sess *IntranetSession) DoLose(msg *protocol.MSG_MGR_LOSE_SERVER)

DoLose : 节点丢失时处理

func (*IntranetSession) DoRecv

func (sess *IntranetSession) DoRecv(cmd uint64, data []byte, flag byte) (done bool)

DoRecv : 节点收到消息处理

func (*IntranetSession) DoRegister

func (sess *IntranetSession) DoRegister(msg *protocol.MSG_MGR_REGISTER_SERVER)

DoRegister : 某节点注册时处理

func (*IntranetSession) DoVerify

func (sess *IntranetSession) DoVerify(msg *protocol.MSG_MGR_REGISTER_SERVER)

DoVerify : 验证时保存自己的注册消息

func (*IntranetSession) Start

func (sess *IntranetSession) Start()

Start : 启动

type IntranetSessionMgr

type IntranetSessionMgr struct {
	// contains filtered or unexported fields
}

IntranetSessionMgr : IntranetSession 对象管理类

func NewIntranetSessionMgr

func NewIntranetSessionMgr(ctx *common.Context) *IntranetSessionMgr

NewIntranetSessionMgr :

func (*IntranetSessionMgr) AddUser

func (mgr *IntranetSessionMgr) AddUser(account string, sess *nodecommon.SessionBase)

AddUser :

func (*IntranetSessionMgr) Close

func (mgr *IntranetSessionMgr) Close()

Close : 结束

func (*IntranetSessionMgr) DelUser

func (mgr *IntranetSessionMgr) DelUser(account string)

DelUser :

func (*IntranetSessionMgr) GetAndActive

func (mgr *IntranetSessionMgr) GetAndActive(account string) *nodecommon.SessionBase

GetAndActive :

func (*IntranetSessionMgr) Start

func (mgr *IntranetSessionMgr) Start()

Start : 开始

type Normal

type Normal struct {
	*Session
	// contains filtered or unexported fields
}

Normal : 普通节点

func NewNormal

func NewNormal(ctx *common.Context) *Normal

NewNormal : 普通节点实现类的构造函数

func (*Normal) Close

func (normal *Normal) Close()

Close : 关闭节点

func (*Normal) Start

func (normal *Normal) Start() bool

Start : 节点开始工作

type Session

type Session struct {
	*nodecommon.SessionBase
	GWMgr *IntranetSessionMgr
	// contains filtered or unexported fields
}

Session : 网络会话类

func NewSession

func NewSession(ctx *common.Context) *Session

NewSession : 网络会话类的构造函数

func (*Session) BroadcastMsgToClient

func (sess *Session) BroadcastMsgToClient(cmd uint64, data []byte, flag uint8) bool

BroadcastMsgToClient : 广播消息给客户端,通过 Gateway 中继

func (*Session) BroadcastMsgToServer

func (sess *Session) BroadcastMsgToServer(t config.NodeType, cmd uint64, data []byte, flag uint8) bool

BroadcastMsgToServer : 广播消息给某类型服务

func (*Session) DoClose

func (sess *Session) DoClose(sessbase *nodecommon.SessionBase)

DoClose : 节点关闭时处理

func (*Session) DoLose

func (sess *Session) DoLose(msg *protocol.MSG_MGR_LOSE_SERVER)

DoLose : 节点丢失时处理

func (*Session) DoRecv

func (sess *Session) DoRecv(cmd uint64, data []byte, flag byte) (done bool)

DoRecv : 节点收到消息处理

func (*Session) DoRegister

func (sess *Session) DoRegister(msg *protocol.MSG_MGR_REGISTER_SERVER)

DoRegister : 某节点注册时处理

func (*Session) DoVerify

func (sess *Session) DoVerify(msg *protocol.MSG_MGR_REGISTER_SERVER)

DoVerify : 验证时保存自己的注册消息

func (*Session) Ping

func (sess *Session) Ping()

Ping : ping

func (*Session) ReplyMsgToServer

func (sess *Session) ReplyMsgToServer(targetID context.NodeID, cmd uint64, data []byte, flag uint8) bool

ReplyMsgToServer : 回发消息给请求服务器

func (*Session) SendMsgToClient

func (sess *Session) SendMsgToClient(account string, cmd uint64, data []byte, flag uint8) bool

SendMsgToClient : 发送消息给客户端,通过 Gateway 中继

func (*Session) SendMsgToServer

func (sess *Session) SendMsgToServer(t config.NodeType, cmd uint64, data []byte, flag uint8) bool

SendMsgToServer : 发送消息给某类型服务(随机一个)

func (*Session) Shutdown

func (sess *Session) Shutdown()

Shutdown : 关闭

func (*Session) Start

func (sess *Session) Start() bool

Start : 开始连接 Mgr Server

type User

type User struct {
	Account         string
	Sess            *nodecommon.SessionBase
	ActiveTimestamp int64
}

User :

func NewUser

func NewUser(account string, sess *nodecommon.SessionBase) *User

NewUser :

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL