mirror of https://github.com/v2ray/v2ray-core
fix #1207
parent
d16886e51c
commit
cd7a8595d9
|
@ -46,7 +46,7 @@ func (r *cachedReader) ReadMultiBuffer() (buf.MultiBuffer, error) {
|
||||||
r.Lock()
|
r.Lock()
|
||||||
defer r.Unlock()
|
defer r.Unlock()
|
||||||
|
|
||||||
if !r.cache.IsEmpty() {
|
if r.cache != nil && !r.cache.IsEmpty() {
|
||||||
mb := r.cache
|
mb := r.cache
|
||||||
r.cache = nil
|
r.cache = nil
|
||||||
return mb, nil
|
return mb, nil
|
||||||
|
@ -59,7 +59,7 @@ func (r *cachedReader) ReadMultiBufferTimeout(timeout time.Duration) (buf.MultiB
|
||||||
r.Lock()
|
r.Lock()
|
||||||
defer r.Unlock()
|
defer r.Unlock()
|
||||||
|
|
||||||
if !r.cache.IsEmpty() {
|
if r.cache != nil && !r.cache.IsEmpty() {
|
||||||
mb := r.cache
|
mb := r.cache
|
||||||
r.cache = nil
|
r.cache = nil
|
||||||
return mb, nil
|
return mb, nil
|
||||||
|
@ -70,8 +70,10 @@ func (r *cachedReader) ReadMultiBufferTimeout(timeout time.Duration) (buf.MultiB
|
||||||
|
|
||||||
func (r *cachedReader) CloseError() {
|
func (r *cachedReader) CloseError() {
|
||||||
r.Lock()
|
r.Lock()
|
||||||
r.cache.Release()
|
if r.cache != nil {
|
||||||
r.cache = nil
|
r.cache.Release()
|
||||||
|
r.cache = nil
|
||||||
|
}
|
||||||
r.Unlock()
|
r.Unlock()
|
||||||
r.reader.CloseError()
|
r.reader.CloseError()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue