mux

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MUX_PING_FLAG int32 = iota
	MUX_NEW_CONN_OK
	MUX_NEW_CONN_Fail
	MUX_NEW_MSG
	MUX_MSG_SEND_OK
	MUX_NEW_CONN
	MUX_PING
	MUX_CONN_CLOSE
	MUX_PING_RETURN
	RETRY_TIME = 2 //Heart beat allowed fault tolerance times
)

Variables

This section is empty.

Functions

func NewConn

func NewConn(connId int32, mux *Mux, sendMsgCh chan *msg, sendStatusCh chan int32) *conn

func NewConnMap

func NewConnMap() *connMap

func NewMsg

func NewMsg(connId int32, content []byte) *msg

func ReadLenBytes

func ReadLenBytes(buf []byte, r io.Reader) (int, error)

read bytes by length

func WriteLenBytes

func WriteLenBytes(buf []byte, w io.Writer) (int, error)

write bytes with int32 length

Types

type Mux

type Mux struct {
	net.Listener

	IsClose bool

	sync.Mutex
	// contains filtered or unexported fields
}

func NewMux

func NewMux(c net.Conn) *Mux

func (*Mux) Accept

func (s *Mux) Accept() (net.Conn, error)

func (*Mux) Addr

func (s *Mux) Addr() net.Addr

func (*Mux) Close

func (s *Mux) Close() error

func (*Mux) NewConn

func (s *Mux) NewConn() (*conn, error)

Jump to

Keyboard shortcuts

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