make it faster
This commit is contained in:
@ -111,20 +111,22 @@ func (h *testStreamHandler) handleStreamMisbehave(t *testing.T, s *Stream) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
t.Fatalf("Failed to convert %v to *http2Server", s.ServerTransport())
|
t.Fatalf("Failed to convert %v to *http2Server", s.ServerTransport())
|
||||||
}
|
}
|
||||||
var end int
|
var sent int
|
||||||
|
p := make([]byte, http2MaxFrameLen)
|
||||||
|
for sent < initialWindowSize {
|
||||||
|
<-conn.writableChan
|
||||||
|
n := initialWindowSize - sent
|
||||||
|
// The last message may be smaller than http2MaxFrameLen
|
||||||
|
if n < http2MaxFrameLen {
|
||||||
if s.Method() == "foo.Connection" {
|
if s.Method() == "foo.Connection" {
|
||||||
// Violate connection level flow control window of client but do not
|
// Violate connection level flow control window of client but do not
|
||||||
// violate any stream level windows.
|
// violate any stream level windows.
|
||||||
end = initialWindowSize
|
p = make([]byte, n)
|
||||||
} else {
|
} else {
|
||||||
// Violate stream level flow control window of client.
|
// Violate stream level flow control window of client.
|
||||||
end = initialWindowSize + 1
|
p = make([]byte, n+1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Violate the client side stream/connection flow control window.
|
|
||||||
var sent int
|
|
||||||
p := make([]byte, 1)
|
|
||||||
for sent < end {
|
|
||||||
<-conn.writableChan
|
|
||||||
if err := conn.framer.writeData(true, s.id, false, p); err != nil {
|
if err := conn.framer.writeData(true, s.id, false, p); err != nil {
|
||||||
conn.writableChan <- 0
|
conn.writableChan <- 0
|
||||||
break
|
break
|
||||||
|
Reference in New Issue
Block a user