finclip-app-manager/vendor/github.com/Shopify/sarama/response_header.go

25 lines
495 B
Go
Raw Permalink Normal View History

2023-11-02 18:36:36 +08:00
package sarama
import "fmt"
const responseLengthSize = 4
const correlationIDSize = 4
type responseHeader struct {
length int32
correlationID int32
}
func (r *responseHeader) decode(pd packetDecoder) (err error) {
r.length, err = pd.getInt32()
if err != nil {
return err
}
if r.length <= 4 || r.length > MaxResponseSize {
return PacketDecodingError{fmt.Sprintf("message of length %d too large or too small", r.length)}
}
r.correlationID, err = pd.getInt32()
return err
}