mirror of https://bitbucket.org/ausocean/av.git
readFrom() now logs a warning if it is reading a large packet (which I suspect never happens).
This commit is contained in:
parent
828cc3780a
commit
ddd1e4ab17
|
@ -203,12 +203,11 @@ func (pkt *packet) readFrom(c *Conn) error {
|
||||||
pkt.resize(pkt.bodySize, (hbuf[0]&0xc0)>>6)
|
pkt.resize(pkt.bodySize, (hbuf[0]&0xc0)>>6)
|
||||||
}
|
}
|
||||||
|
|
||||||
sz := c.inChunkSize
|
if pkt.bodySize > c.inChunkSize {
|
||||||
if pkt.bodySize < sz {
|
c.log(WarnLevel, pkg+"reading large packet", "size", int(pkt.bodySize))
|
||||||
sz = pkt.bodySize
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = c.read(pkt.body[:sz])
|
_, err = c.read(pkt.body[:pkt.bodySize])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log(DebugLevel, pkg+"failed to read packet body", "error", err.Error())
|
c.log(DebugLevel, pkg+"failed to read packet body", "error", err.Error())
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue