mirror of https://github.com/schollz/croc.git
debugging the comm
This commit is contained in:
parent
97f7f28f6e
commit
cb522f2f06
|
@ -83,6 +83,7 @@ func (c *Comm) Read() (buf []byte, numBytes int, bs []byte, err error) {
|
||||||
n, errRead := c.connection.Read(tmp)
|
n, errRead := c.connection.Read(tmp)
|
||||||
if errRead != nil {
|
if errRead != nil {
|
||||||
err = errRead
|
err = errRead
|
||||||
|
logger.Debug("initial read error: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
header = append(header, tmp[:n]...)
|
header = append(header, tmp[:n]...)
|
||||||
|
@ -96,6 +97,7 @@ func (c *Comm) Read() (buf []byte, numBytes int, bs []byte, err error) {
|
||||||
err = binary.Read(rbuf, binary.LittleEndian, &numBytesUint32)
|
err = binary.Read(rbuf, binary.LittleEndian, &numBytesUint32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("binary.Read failed: %s", err.Error())
|
err = fmt.Errorf("binary.Read failed: %s", err.Error())
|
||||||
|
logger.Debug(err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
numBytes = int(numBytesUint32)
|
numBytes = int(numBytesUint32)
|
||||||
|
@ -114,6 +116,7 @@ func (c *Comm) Read() (buf []byte, numBytes int, bs []byte, err error) {
|
||||||
n, errRead := c.connection.Read(tmp)
|
n, errRead := c.connection.Read(tmp)
|
||||||
if errRead != nil {
|
if errRead != nil {
|
||||||
err = errRead
|
err = errRead
|
||||||
|
logger.Debug("consecutive read error: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buf = append(buf, tmp[:n]...)
|
buf = append(buf, tmp[:n]...)
|
||||||
|
|
Loading…
Reference in New Issue