本文整理汇总了Golang中github.com/mdlayher/aoe.Header.FlagResponse方法的典型用法代码示例。如果您正苦于以下问题:Golang Header.FlagResponse方法的具体用法?Golang Header.FlagResponse怎么用?Golang Header.FlagResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/mdlayher/aoe.Header
的用法示例。
在下文中一共展示了Header.FlagResponse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Send
func (fs *FrameSender) Send(hdr *aoe.Header) (int, error) {
hdr.Version = 1
hdr.FlagResponse = true
hdr.Major = fs.major
hdr.Minor = fs.minor
hdr.Tag = fs.orig.Tag
hbuf, err := hdr.MarshalBinary()
if err != nil {
panic(err)
}
frame := ðernet.Frame{
Destination: fs.dst,
Source: fs.src,
EtherType: aoe.EtherType,
Payload: hbuf,
}
ebuf, err := frame.MarshalBinary()
if err != nil {
panic(err)
}
clog.Debugf("send %d %s %+v", len(ebuf), fs.dst, hdr)
//clog.Debugf("send arg %+v", hdr.Arg)
return fs.conn.WriteTo(ebuf, &raw.Addr{HardwareAddr: fs.dst})
}
示例2: headersEqual
// headersEqual compares a response and request AoE header for equality, but
// does not factor in their Arg fields.
func headersEqual(res, req aoe.Header) bool {
if !res.FlagResponse {
panic("response AoE header did not have FlagResponse set, please verify parameter order")
}
// Set request's response flag for comparison
req.FlagResponse = true
// Clear arguments of both request and response so we can compare the
// headers, and because the arguments are compared separately
req.Arg = nil
res.Arg = nil
return reflect.DeepEqual(res, req)
}