mirror of
https://github.com/ehang-io/nps.git
synced 2025-07-02 20:30:43 +00:00
fix bug 250
This commit is contained in:
parent
3e26af308c
commit
eccf3c2be1
@ -87,7 +87,7 @@ func (s *Conn) GetShortContent(l int) (b []byte, err error) {
|
||||
|
||||
//读取指定长度内容
|
||||
func (s *Conn) ReadLen(cLen int, buf []byte) (int, error) {
|
||||
if cLen > len(buf) {
|
||||
if cLen > len(buf) || cLen <= 0 {
|
||||
return 0, errors.New("长度错误" + strconv.Itoa(cLen))
|
||||
}
|
||||
if n, err := io.ReadFull(s, buf[:cLen]); err != nil || n != cLen {
|
||||
|
Loading…
x
Reference in New Issue
Block a user