修复encrypt.Conn释放内存,导致的潜在panic问题.
This commit is contained in:
@ -35,13 +35,13 @@ func NewConn(c net.Conn, method, password string) (conn net.Conn, err error) {
|
|||||||
}
|
}
|
||||||
func (s *Conn) Read(b []byte) (n int, err error) {
|
func (s *Conn) Read(b []byte) (n int, err error) {
|
||||||
if s.r == nil {
|
if s.r == nil {
|
||||||
return 0, fmt.Errorf("use of closed connection")
|
return 0, fmt.Errorf("use of closed network connection")
|
||||||
}
|
}
|
||||||
return s.r.Read(b)
|
return s.r.Read(b)
|
||||||
}
|
}
|
||||||
func (s *Conn) Write(b []byte) (n int, err error) {
|
func (s *Conn) Write(b []byte) (n int, err error) {
|
||||||
if s.w == nil {
|
if s.w == nil {
|
||||||
return 0, fmt.Errorf("use of closed connection")
|
return 0, fmt.Errorf("use of closed network connection")
|
||||||
}
|
}
|
||||||
return s.w.Write(b)
|
return s.w.Write(b)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user