mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-03 00:22:05 +00:00
task engine for all proxies
This commit is contained in:
10 files changed
+304
-174
No files matched your search
@@ -65,6 +65,8 @@ func (v *Stream) Read() (*buf.Buffer, error) {
|
||||
return b, nil
|
||||
case <-v.srcClose:
|
||||
return nil, io.EOF
|
||||
case <-v.destClose:
|
||||
return nil, io.ErrClosedPipe
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,7 +99,7 @@ func (v *Stream) Close() {
|
||||
close(v.srcClose)
|
||||
}
|
||||
|
||||
func (v *Stream) Release() {
|
||||
func (v *Stream) ForceClose() {
|
||||
defer swallowPanic()
|
||||
|
||||
close(v.destClose)
|
||||
@@ -114,6 +116,8 @@ func (v *Stream) Release() {
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Stream) Release() {}
|
||||
|
||||
func swallowPanic() {
|
||||
recover()
|
||||
}
|
||||
@@ -36,9 +36,11 @@ type Ray interface {
|
||||
type InputStream interface {
|
||||
buf.Reader
|
||||
Close()
|
||||
ForceClose()
|
||||
}
|
||||
|
||||
type OutputStream interface {
|
||||
buf.Writer
|
||||
Close()
|
||||
ForceClose()
|
||||
}
|
||||
Reference in new issue
Block a user