mirror of https://github.com/v2ray/v2ray-core
parent
163fe2523e
commit
ce91e92435
|
@ -148,12 +148,13 @@ func (r *BufferedReader) WriteTo(writer io.Writer) (int64, error) {
|
||||||
return nBytes, err
|
return nBytes, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Interrupt implements common.Interruptible.
|
||||||
|
func (r *BufferedReader) Interrupt() {
|
||||||
|
common.Interrupt(r.Reader)
|
||||||
|
}
|
||||||
|
|
||||||
// Close implements io.Closer.
|
// Close implements io.Closer.
|
||||||
func (r *BufferedReader) Close() error {
|
func (r *BufferedReader) Close() error {
|
||||||
if !r.Buffer.IsEmpty() {
|
|
||||||
ReleaseMulti(r.Buffer)
|
|
||||||
r.Buffer = nil
|
|
||||||
}
|
|
||||||
return common.Close(r.Reader)
|
return common.Close(r.Reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (c *connection) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
||||||
// Close implements net.Conn.Close().
|
// Close implements net.Conn.Close().
|
||||||
func (c *connection) Close() error {
|
func (c *connection) Close() error {
|
||||||
common.Must(c.done.Close())
|
common.Must(c.done.Close())
|
||||||
common.Close(c.reader)
|
common.Interrupt(c.reader)
|
||||||
common.Close(c.writer)
|
common.Close(c.writer)
|
||||||
if c.onClose != nil {
|
if c.onClose != nil {
|
||||||
return c.onClose.Close()
|
return c.onClose.Close()
|
||||||
|
|
Loading…
Reference in New Issue