1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-01 23:15:21 -05:00

Release all references

This commit is contained in:
v2ray
2016-03-11 23:51:58 +01:00
parent f5960db27e
commit ff69ac7a0e
9 changed files with 42 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ package io // import "github.com/v2ray/v2ray-core/common/io"
import (
"io"
"github.com/v2ray/v2ray-core/common"
"github.com/v2ray/v2ray-core/common/alloc"
)
@@ -23,6 +24,11 @@ type Reader interface {
Read() (*alloc.Buffer, error)
}
type ReleasableReader interface {
Reader
common.Releasable
}
// AdaptiveReader is a Reader that adjusts its reading speed automatically.
type AdaptiveReader struct {
reader io.Reader
@@ -57,3 +63,7 @@ func (this *AdaptiveReader) Read() (*alloc.Buffer, error) {
}
return buffer, nil
}
func (this *AdaptiveReader) Release() {
this.reader = nil
}