MCPcopy
hub / github.com/aceld/zinx / FrameDecoder

Struct FrameDecoder

zinterceptor/framedecoder.go:307–316  ·  view source on GitHub ↗

FrameDecoder A decoder that splits the received ByteBufs dynamically by the value of the length field in the message. It is particularly useful when you decode a binary message which has an integer header field that represents the length of the message body or the whole message. ziface.Len

Source from the content-addressed store, hash-verified

305
306// FrameDecoder is a decoder based on the LengthField pattern.
307type FrameDecoder struct {
308 ziface.LengthField // Basic properties inherited from ILengthField
309
310 LengthFieldEndOffset int // Offset of the end position of the length field (LengthFieldOffset+LengthFieldLength) (长度字段结束位置的偏移量)
311 failFast bool // Fast failure (快速失败)
312 discardingTooLongFrame bool // true indicates discard mode is enabled, false indicates normal working mode (true 表示开启丢弃模式,false 正常工作模式)
313 tooLongFrameLength int64 // When the length of a packet exceeds maxLength, discard mode is enabled, and this field records the length of the data to be discarded (当某个数据包的长度超过maxLength,则开启丢弃模式,此字段记录需要丢弃的数据长度)
314 bytesToDiscard int64 // Records how many bytes still need to be discarded (记录还剩余多少字节需要丢弃)
315 in []byte
316}
317
318func NewFrameDecoder(lf ziface.LengthField) ziface.IFrameDecoder {
319

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected