srvlib

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknowServiceType  int = 0
	ClientServiceType      = 1
	BalanceServiceType     = 2
	AccountServiceType     = 3
	GateServiceType        = 4
	ManagerServiceType     = 5
	WorldServiceType       = 6
	GameServiceType        = 7
	MaxServiceType         = 8
)
View Source
const (
	UnknowServerType int = 0

	BalanceServerType = 2
	AccountServerType = 3
	GateServerType    = 4
	ManagerServerType = 5
	WorldServerType   = 6
	GameServerType    = 7
	MaxServerType     = 8
)
View Source
const (
	SessionIdSeqIdBits     uint32 = 32
	SessionIdSrvIdBits            = 16
	SessionIdSrvTypeBits          = 8
	SessionIdSrvAreaIdBits        = 8
	SessionIdSrvIdOffset          = SessionIdSeqIdBits
	SessionIdSrvTypeOffset        = SessionIdSrvIdOffset + SessionIdSrvIdBits
	SessionIdSrvAreaOffset        = SessionIdSrvTypeOffset + SessionIdSrvTypeBits
	SessionIdSeqIdMask            = 1<<SessionIdSeqIdBits - 1
	SessionIdSrvIdMask            = 1<<SessionIdSrvIdBits - 1
	SessionIdSrvTypeMask          = 1<<SessionIdSrvTypeBits - 1
	SessionIdSrvAreaIdMask        = 1<<SessionIdSrvAreaIdBits - 1
)

Variables

View Source
var (
	SessionAttributeClientSession = &ClientSessionMgr{}
	ClientSessionMgrSington       = &ClientSessionMgr{sessions: make(map[int64]*netlib.Session)}
)
View Source
var (
	SessionAttributeServerInfo = &ServerSessionMgr{}
	ServerSessionMgrSington    = &ServerSessionMgr{sessions: make(map[int]map[int]map[int]*netlib.Session)}
)
View Source
var (
	SessionAttributeServiceInfo = &serviceMgr{}
	SessionAttributeServiceFlag = &serviceMgr{}
	ServiceMgr                  = &serviceMgr{servicesPool: make(map[int32]map[int32]*protocol.ServiceInfo)}
)

Functions

func GetCareServicesBySession

func GetCareServicesBySession(sessionType int32) []int32

func GetCareSessionsByService

func GetCareSessionsByService(serviceType int32) []int32

func Register1ToMHandler

func Register1ToMHandler(h Handler, packetIds ...int)

func RegisterHandler

func RegisterHandler(packetId int, h Handler)

func RegisterRangeHandler

func RegisterRangeHandler(start, end int, h Handler)

func SessionCareService

func SessionCareService(sessionType, serviceType int32) bool

Types

type ClientSessionMgr

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

func (*ClientSessionMgr) Broadcast

func (csm *ClientSessionMgr) Broadcast(packetid int, pack interface{})

func (*ClientSessionMgr) CloseAll

func (csm *ClientSessionMgr) CloseAll()

func (*ClientSessionMgr) Count

func (csm *ClientSessionMgr) Count() int

func (*ClientSessionMgr) GetSession

func (csm *ClientSessionMgr) GetSession(srvId int64) *netlib.Session

func (*ClientSessionMgr) GetSessions

func (csm *ClientSessionMgr) GetSessions() map[int64]*netlib.Session

func (*ClientSessionMgr) RegisteSession

func (csm *ClientSessionMgr) RegisteSession(s *netlib.Session) bool

func (*ClientSessionMgr) UnregisteSession

func (csm *ClientSessionMgr) UnregisteSession(s *netlib.Session) bool

type Handler

type Handler interface {
	Process(s *netlib.Session, packetid int, data interface{}, sid int64, routes []*protocol.SrvInfo) error
}

func GetHandler

func GetHandler(packetId int) Handler

type HandlerWrapper

type HandlerWrapper func(s *netlib.Session, packetid int, data interface{}, sid int64, routes []*protocol.SrvInfo) error

func (HandlerWrapper) Process

func (hw HandlerWrapper) Process(s *netlib.Session, packetid int, data interface{}, sid int64, routes []*protocol.SrvInfo) error

type ServerSessionMgr

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

func (*ServerSessionMgr) AddListener

func (*ServerSessionMgr) Broadcast

func (ssm *ServerSessionMgr) Broadcast(packetid int, pack interface{}, areaId, srvType int)

func (*ServerSessionMgr) GetServerId

func (ssm *ServerSessionMgr) GetServerId(areaId, srvType int) int

func (*ServerSessionMgr) GetServerIdByMaxData

func (ssm *ServerSessionMgr) GetServerIdByMaxData(areaId, srvType int) int

func (*ServerSessionMgr) GetServerIds

func (ssm *ServerSessionMgr) GetServerIds(areaId, srvType int) (ids []int)

func (*ServerSessionMgr) GetSession

func (ssm *ServerSessionMgr) GetSession(areaId, srvType, srvId int) *netlib.Session

func (*ServerSessionMgr) GetSessions

func (ssm *ServerSessionMgr) GetSessions(areaId, srvType int) (sessions []*netlib.Session)

func (*ServerSessionMgr) RegisteSession

func (ssm *ServerSessionMgr) RegisteSession(s *netlib.Session) bool

func (*ServerSessionMgr) UnregisteSession

func (ssm *ServerSessionMgr) UnregisteSession(s *netlib.Session) bool

type ServerSessionRegisteListener

type ServerSessionRegisteListener interface {
	OnRegiste(*netlib.Session)
	OnUnregiste(*netlib.Session)
}

type ServiceRegisteListener

type ServiceRegisteListener interface {
	OnRegiste([]*protocol.ServiceInfo)
	OnUnregiste(*protocol.ServiceInfo)
}

type SessionId

type SessionId int64

func NewSessionId

func NewSessionId(s *netlib.Session) SessionId

func NewSessionIdEx

func NewSessionIdEx(areaId, srvType, srvId, seq int32) SessionId

func (SessionId) AreaId

func (id SessionId) AreaId() uint32

func (SessionId) Get

func (id SessionId) Get() int64

func (SessionId) IsNil

func (id SessionId) IsNil() bool

func (SessionId) SeqId

func (id SessionId) SeqId() uint32

func (*SessionId) Set

func (id *SessionId) Set(sid int64)

func (SessionId) SrvId

func (id SessionId) SrvId() uint32

func (SessionId) SrvType

func (id SessionId) SrvType() uint32

type TxCommSkeleton

type TxCommSkeleton struct {
}

func (*TxCommSkeleton) GetAreaID

func (tcs *TxCommSkeleton) GetAreaID() int

func (*TxCommSkeleton) GetSkeletonID

func (tcs *TxCommSkeleton) GetSkeletonID() int

func (*TxCommSkeleton) SendCmdToTransNode

func (tcs *TxCommSkeleton) SendCmdToTransNode(tnp *transact.TransNodeParam, c transact.TransCmd) bool

func (*TxCommSkeleton) SendTransResult

func (tcs *TxCommSkeleton) SendTransResult(parent, me *transact.TransNodeParam, tr *transact.TransResult) bool

func (*TxCommSkeleton) SendTransStart

func (tcs *TxCommSkeleton) SendTransStart(parent, me *transact.TransNodeParam, ud interface{}) bool

Directories

Path Synopsis
SessionHandlerClientRegiste
SessionHandlerClientRegiste

Jump to

Keyboard shortcuts

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