Documentation
¶
Index ¶
Constants ¶
View Source
const Guar_NO = uint8(0x55) //01010101
View Source
const Guar_YES = uint8(0xAA) //10101010
View Source
const MSG_HEADER_LEN = 8 //unsafe.Sizeof(p)
************ 消息头的相关处理 ************
0 1 2 3 4 5 6 7 ----------------------------------------- |Guar|Ver | MsgLen | MsgType | MsgId | ----------------------------------------- | Body... | -----------------------------------------
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct { *sync.Mutex //kcp操作锁,因为有可能并发创建kcp,所以必须在Conn创建之初创建锁 // contains filtered or unexported fields }
Conn 每条连接建立一个Conn
type Header ¶
type IMsg ¶
type IMsg interface { RecvMsg(pSess *session.Session, log *log.TraceInfoST) (msgs []PkgRtn, err error) IMsgRtn }
IMsg 是路由层(消息分发层)和逻辑层(消息处理层)之间传递的数据结构,Msg:message的缩写
type IMsgRtn ¶
type IMsgRtn interface { MsgNO() uint16 //消息编号 //以下是 proto.Message 接口的所有方法,所以IWsRequest是可以转化为 proto.Message 接口的 Reset() String() string ProtoMessage() }
IMsgRtn 是路由层(消息分发层)和逻辑层(消息处理层)之间传递的数据结构,Msg:message的缩写
Click to show internal directories.
Click to hide internal directories.