Must not call hex.Dump in non-debug mode...
This commit is contained in:
parent
2b6a6b91f3
commit
e3c0fba34b
@ -16,3 +16,7 @@ var (
|
|||||||
func init() {
|
func init() {
|
||||||
l.SetDebug("protocol", strings.Contains(os.Getenv("STTRACE"), "protocol") || os.Getenv("STTRACE") == "all")
|
l.SetDebug("protocol", strings.Contains(os.Getenv("STTRACE"), "protocol") || os.Getenv("STTRACE") == "all")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func shouldDebug() bool {
|
||||||
|
return l.ShouldDebug("protocol")
|
||||||
|
}
|
||||||
|
|||||||
@ -411,10 +411,12 @@ func (c *rawConnection) readMessage() (hdr header, msg encodable, err error) {
|
|||||||
l.Debugf("decompressed to %d bytes", len(msgBuf))
|
l.Debugf("decompressed to %d bytes", len(msgBuf))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(msgBuf) > 1024 {
|
if shouldDebug() {
|
||||||
l.Debugf("message data:\n%s", hex.Dump(msgBuf[:1024]))
|
if len(msgBuf) > 1024 {
|
||||||
} else {
|
l.Debugf("message data:\n%s", hex.Dump(msgBuf[:1024]))
|
||||||
l.Debugf("message data:\n%s", hex.Dump(msgBuf))
|
} else {
|
||||||
|
l.Debugf("message data:\n%s", hex.Dump(msgBuf))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We check each returned error for the XDRError.IsEOF() method.
|
// We check each returned error for the XDRError.IsEOF() method.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user