gob

package
v0.0.0-...-5a37ffa Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSuportType = errors.New("type is not suported")
View Source
var ErrPendingTooLong = errors.New("call is pending too long")
View Source
var ErrSendError = errors.New("got error when send to network")
View Source
var ErrShutdown = errors.New("connection is shut down")

Functions

func Dial

func Dial(network, address string) (chan IMsg, chan IMsg, error)

func Register

func Register(msg IMsg) (err error)

Register msg要先注册后,才能正确接收该类型的数据

Types

type Codec

type Codec interface {
	ReadHeader(*Header) error
	ReadBody(interface{}) error
	// Write must be safe for concurrent use by multiple goroutines.
	Write(header *Header, body interface{}) error

	Close() error
}
type Header struct {
	MsgNO uint32 //
	// contains filtered or unexported fields
}

type IMsg

type IMsg interface {
	RecvMsg(connID int, logT *log.TraceInfoST)
	MsgNO() uint16 //返回对应的消息编号,每种消息一个编号,保证唯一性
}

IMsg 是路由层(消息分发层)和逻辑层(消息处理层)之间传递的数据结构,Msg:message的缩写

type Peer

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

Peer 一条连接一个Peer,连接的相关的信息可以存这里

func NewPeer

func NewPeer() *Peer

NewPeer returns a new Peer.

func (*Peer) ServeConn

func (p *Peer) ServeConn(conn io.ReadWriteCloser) (chan IMsg, chan IMsg, error)

type ServerError

type ServerError string

func (ServerError) Error

func (e ServerError) Error() string

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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