mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
fix #638
This commit is contained in:
parent
66b81a842d
commit
62258e6aef
@ -143,15 +143,20 @@ func (s *Stream) ReadTimeout(timeout time.Duration) (buf.MultiBuffer, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Size returns the number of bytes hold in the Stream.
|
||||
func (s *Stream) Size() uint64 {
|
||||
s.access.RLock()
|
||||
defer s.access.RUnlock()
|
||||
|
||||
return s.size
|
||||
}
|
||||
|
||||
func (s *Stream) waitForStreamSize() error {
|
||||
if streamSizeLimit == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
s.access.RLock()
|
||||
defer s.access.RUnlock()
|
||||
|
||||
for streamSizeLimit > 0 && s.size >= streamSizeLimit {
|
||||
for s.Size() >= streamSizeLimit {
|
||||
select {
|
||||
case <-s.ctx.Done():
|
||||
return io.ErrClosedPipe
|
||||
|
Loading…
Reference in New Issue
Block a user