Documentation ¶
Index ¶
- Constants
- Variables
- func GetNowTick() int64
- func RpcMarshal(b []byte, val interface{}) []byte
- func RpcUnMarshal(b []byte) (interface{}, []byte)
- func Run()
- func SetKeepAlive(open bool, pingTime int64)
- type Agent
- type AgentID
- type Component
- type ComponentID
- type ComponentType
- type ConnType
- type EventQueue
- type EventReceiver
- type ITcpClientMgr
- type ITcpServerMgr
- type Linker
- type NetLinker
- type Option
- type PingEventMsg
- type PingMgr
- type ProtoTypeID
- type ServerType
- type SessionHandler
- type SessionMgr
- type TcpClientMgr
- type TcpConn
- func (this *TcpConn) BeginPing()
- func (this *TcpConn) Close()
- func (this *TcpConn) Destroy()
- func (this *TcpConn) DoPing()
- func (this *TcpConn) GetID() AgentID
- func (this *TcpConn) GetLastPingTime() int64
- func (this *TcpConn) GetType() int16
- func (this *TcpConn) GetUserType() int16
- func (this *TcpConn) IsClosed() bool
- func (this *TcpConn) LocalAddr() net.Addr
- func (this *TcpConn) Ping() bool
- func (this *TcpConn) Pong(now_tick int64)
- func (this *TcpConn) ReadMsg() ([]byte, error)
- func (this *TcpConn) RemoteAddr() net.Addr
- func (this *TcpConn) RpcCall(msg_id ProtoTypeID, b []byte) bool
- func (this *TcpConn) Run()
- func (this *TcpConn) SetUserType(t int16)
- func (this *TcpConn) WriteMsg(msg_id ProtoTypeID, b []byte) bool
- type TcpServerMgr
- type TimerHandler
- type TimerManager
- type TransportOption
- type WriteWrapper
Constants ¶
View Source
const ( PING_OP_TYPE_ADD_PING = iota PING_OP_TYPE_REMOVE_PING )
View Source
const ( Linker_TCP_InComming = iota Linker_TCP_OutGoing )
View Source
const ( ConnType_TCP = iota ConnType_UDP )
View Source
const ( COMPONENT_TYPE_TCP_SERVER = component.COMPONENT_TYPE_TCP_SERVER COMPONENT_TYPE_TCP_CLIENT = component.COMPONENT_TYPE_TCP_CLIENT )
View Source
const ( MSG_KEY_LENGTH = 32 MSG_HEADER_LENGTH = 4 MSG_ID_LENGTH = 4 MSG_MAX_BODY_LENGTH = 8096 MSG_DEFAULT_BUF_LENGTH = 1024 MSG_DEFAULT_COUNT = 100 )
View Source
const BUFFER_BASE_SIZE = 1024
View Source
const KEEP_ALIVE_POLL_COUNT = 128
View Source
const TCP_ACCEPT_SLEEP = 150
Variables ¶
Functions ¶
func GetNowTick ¶
func GetNowTick() int64
func RpcMarshal ¶
func RpcUnMarshal ¶
func SetKeepAlive ¶
Types ¶
type ComponentID ¶
type ComponentID = component.ComponentID
func GenComponentID ¶
func GenComponentID() ComponentID
type ComponentType ¶
type ComponentType = component.ComponentType
type EventQueue ¶
type EventQueue = event.EventQueue
type EventReceiver ¶
type EventReceiver = event.EventReceiver
type ITcpClientMgr ¶
type ITcpClientMgr interface { GetID() ComponentID GetType() ComponentType Connect(addr string, user_type int16) }
type ITcpServerMgr ¶
type ITcpServerMgr interface { GetID() ComponentID GetType() ComponentType Address() net.Addr }
type Option ¶
type Option = func(...interface{})
func ListenAddr ¶
func Module ¶
func Module(m EventReceiver) Option
func ServeHandler ¶
func ServeHandler(serve_handler SessionHandler) Option
func TransportMaxCount ¶
type PingEventMsg ¶
func (*PingEventMsg) GetSender ¶
func (this *PingEventMsg) GetSender() Agent
func (*PingEventMsg) GetType ¶
func (this *PingEventMsg) GetType() event.EventType
func (*PingEventMsg) Reset ¶
func (this *PingEventMsg) Reset()
type PingMgr ¶
type PingMgr struct {
// contains filtered or unexported fields
}
func (*PingMgr) RemovePing ¶
type ProtoTypeID ¶
type ProtoTypeID = uint32
type ServerType ¶
type ServerType uint32
type SessionHandler ¶
type SessionHandler interface { ServeHandler(Agent, ProtoTypeID, []byte) ServeRpc(Agent, ProtoTypeID, []byte) }
type SessionMgr ¶
type TcpClientMgr ¶
type TcpClientMgr struct {
// contains filtered or unexported fields
}
func (*TcpClientMgr) Close ¶
func (this *TcpClientMgr) Close()
func (*TcpClientMgr) Connect ¶
func (this *TcpClientMgr) Connect(addr string, user_type int16)
func (*TcpClientMgr) GetID ¶
func (this *TcpClientMgr) GetID() ComponentID
func (*TcpClientMgr) GetType ¶
func (this *TcpClientMgr) GetType() ComponentType
func (*TcpClientMgr) Start ¶
func (this *TcpClientMgr) Start()
type TcpConn ¶
type TcpConn struct {
// contains filtered or unexported fields
}
func (*TcpConn) GetLastPingTime ¶
func (*TcpConn) GetUserType ¶
func (*TcpConn) RemoteAddr ¶
func (*TcpConn) SetUserType ¶
type TcpServerMgr ¶
type TcpServerMgr struct {
// contains filtered or unexported fields
}
func (*TcpServerMgr) Address ¶
func (this *TcpServerMgr) Address() net.Addr
func (*TcpServerMgr) Close ¶
func (this *TcpServerMgr) Close()
func (*TcpServerMgr) GetID ¶
func (this *TcpServerMgr) GetID() ComponentID
func (*TcpServerMgr) GetType ¶
func (this *TcpServerMgr) GetType() ComponentType
func (*TcpServerMgr) Start ¶
func (this *TcpServerMgr) Start()
type TimerHandler ¶
type TimerHandler = timer.TimerHandler
type TimerManager ¶
type TimerManager = timer.TimerManager
type TransportOption ¶
type TransportOption struct {
// contains filtered or unexported fields
}
type WriteWrapper ¶
type WriteWrapper struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.