add credit based mux window
This commit is contained in:
+11
-1
@@ -129,6 +129,7 @@ type destMode int
|
||||
const (
|
||||
modeEcho destMode = iota // echo every post-handshake byte
|
||||
modeEchoOnceClose // echo one read, then close the connection
|
||||
modeBlackhole // accept but never read: immediate write back-pressure
|
||||
)
|
||||
|
||||
type proxyInfo struct {
|
||||
@@ -154,6 +155,7 @@ type mockDest struct {
|
||||
mode destMode
|
||||
events chan destEvent
|
||||
connClosed chan struct{}
|
||||
done chan struct{}
|
||||
}
|
||||
|
||||
func newMockDest(t *testing.T, mode destMode) *mockDest {
|
||||
@@ -168,8 +170,12 @@ func newMockDest(t *testing.T, mode destMode) *mockDest {
|
||||
mode: mode,
|
||||
events: make(chan destEvent, 128),
|
||||
connClosed: make(chan struct{}, 128),
|
||||
done: make(chan struct{}),
|
||||
}
|
||||
t.Cleanup(func() { _ = ln.Close() })
|
||||
t.Cleanup(func() {
|
||||
_ = ln.Close()
|
||||
close(d.done)
|
||||
})
|
||||
go d.serve()
|
||||
return d
|
||||
}
|
||||
@@ -189,6 +195,10 @@ func (d *mockDest) handle(conn net.Conn) {
|
||||
_ = conn.Close()
|
||||
d.connClosed <- struct{}{}
|
||||
}()
|
||||
if d.mode == modeBlackhole {
|
||||
<-d.done // hold the connection open without ever reading
|
||||
return
|
||||
}
|
||||
br := bufio.NewReader(conn)
|
||||
|
||||
var ev destEvent
|
||||
|
||||
Reference in New Issue
Block a user