mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
yield goroutine on pipe write
This commit is contained in:
parent
3f3d00298a
commit
956868ef78
@ -3,6 +3,7 @@ package pipe
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -125,6 +126,9 @@ func (p *pipe) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
||||
switch {
|
||||
case err == nil:
|
||||
p.readSignal.Signal()
|
||||
|
||||
// Yield current goroutine. Hopefully the reading counterpart can pick up the payload.
|
||||
runtime.Gosched()
|
||||
return nil
|
||||
case err == errBufferFull && p.discardOverflow:
|
||||
mb.Release()
|
||||
|
Loading…
x
Reference in New Issue
Block a user