session

package
v0.0.0-...-bd0de05 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SESSION_TIMEOUT_SEC = 60
)
View Source
const (
	WRITE_CHAN_SIZE = 2048
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

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

func NewSession

func NewSession(con connInterface.IConnectInterface) *Session

func (*Session) GetActiveTime

func (s *Session) GetActiveTime() int64

func (*Session) GetOwner

func (s *Session) GetOwner() int64

func (*Session) IsClosed

func (s *Session) IsClosed() bool

func (*Session) LocalAddr

func (s *Session) LocalAddr() string

func (*Session) RemoteAddr

func (s *Session) RemoteAddr() string

func (*Session) Run

func (s *Session) Run()

func (*Session) SessionId

func (s *Session) SessionId() string

func (*Session) SetActiveTime

func (s *Session) SetActiveTime(activeTime int64)

func (*Session) SetCallBack

func (s *Session) SetCallBack(
	onDataCallback func(*Session, proto.EnvelopeType, []byte),
	onCloseCallback func(*Session),
) error

func (*Session) SetOwner

func (s *Session) SetOwner(ownerId int64)

func (*Session) Stop

func (s *Session) Stop()

func (*Session) Write

func (s *Session) Write(msgType proto.EnvelopeType, body []byte) error

type SessionManager

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

func NewSessionMgr

func NewSessionMgr(maxConnNum uint32, timeoutSec int64) *SessionManager

func (*SessionManager) AddSession

func (mgr *SessionManager) AddSession(s *Session)

func (*SessionManager) Count

func (mgr *SessionManager) Count() uint32

func (*SessionManager) RangeSessions

func (mgr *SessionManager) RangeSessions(f func(s *Session) bool)

func (*SessionManager) RemoveSession

func (mgr *SessionManager) RemoveSession(s *Session)

func (*SessionManager) SessionById

func (mgr *SessionManager) SessionById(id string) (s *Session)

func (*SessionManager) Stop

func (mgr *SessionManager) Stop()

Jump to

Keyboard shortcuts

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