This commit is contained in:
iamqizhao 2015-03-31 16:46:41 -07:00
Родитель 7987579ac3
Коммит 4214baa3c1
3 изменённых файлов: 34 добавлений и 34 удалений

Просмотреть файл

@ -94,7 +94,7 @@ type http2Client struct {
// The accumulated inbound quota pending for updating the peer.
updateQuota uint32
// the per-stream outbound flow control window size set by the peer.
streamSendQuota uint32
streamSendQuota uint32
}
// newHTTP2Client constructs a connected ClientTransport to addr based on HTTP2
@ -155,21 +155,21 @@ func newHTTP2Client(addr string, opts *DialOptions) (_ ClientTransport, err erro
target: addr,
conn: conn,
// The client initiated stream id is odd starting from 1.
nextID: 1,
writableChan: make(chan int, 1),
shutdownChan: make(chan struct{}),
errorChan: make(chan struct{}),
framer: framer,
hBuf: &buf,
hEnc: hpack.NewEncoder(&buf),
controlBuf: newRecvBuffer(),
recvQuota: initialConnWindowSize,
sendQuotaPool: newQuotaPool(defaultWindowSize),
scheme: scheme,
state: reachable,
activeStreams: make(map[uint32]*Stream),
maxStreams: math.MaxUint32,
authCreds: opts.AuthOptions,
nextID: 1,
writableChan: make(chan int, 1),
shutdownChan: make(chan struct{}),
errorChan: make(chan struct{}),
framer: framer,
hBuf: &buf,
hEnc: hpack.NewEncoder(&buf),
controlBuf: newRecvBuffer(),
recvQuota: initialConnWindowSize,
sendQuotaPool: newQuotaPool(defaultWindowSize),
scheme: scheme,
state: reachable,
activeStreams: make(map[uint32]*Stream),
maxStreams: math.MaxUint32,
authCreds: opts.AuthOptions,
streamSendQuota: defaultWindowSize,
}
go t.controller()

Просмотреть файл

@ -86,7 +86,7 @@ type http2Server struct {
// The accumulated inbound quota pending for updating the peer.
updateQuota uint32
// the per-stream outbound flow control window size set by the peer.
streamSendQuota uint32
streamSendQuota uint32
}
// newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is
@ -118,18 +118,18 @@ func newHTTP2Server(conn net.Conn, maxStreams uint32) (_ ServerTransport, err er
}
var buf bytes.Buffer
t := &http2Server{
conn: conn,
framer: framer,
hBuf: &buf,
hEnc: hpack.NewEncoder(&buf),
maxStreams: maxStreams,
controlBuf: newRecvBuffer(),
recvQuota: initialConnWindowSize,
sendQuotaPool: newQuotaPool(defaultWindowSize),
state: reachable,
writableChan: make(chan int, 1),
shutdownChan: make(chan struct{}),
activeStreams: make(map[uint32]*Stream),
conn: conn,
framer: framer,
hBuf: &buf,
hEnc: hpack.NewEncoder(&buf),
maxStreams: maxStreams,
controlBuf: newRecvBuffer(),
recvQuota: initialConnWindowSize,
sendQuotaPool: newQuotaPool(defaultWindowSize),
state: reachable,
writableChan: make(chan int, 1),
shutdownChan: make(chan struct{}),
activeStreams: make(map[uint32]*Stream),
streamSendQuota: defaultWindowSize,
}
go t.controller()
@ -257,10 +257,10 @@ func (t *http2Server) HandleStreams(handle func(*Stream)) {
t.maxStreamID = id
buf := newRecvBuffer()
curStream = &Stream{
id: frame.Header().StreamID,
st: t,
buf: buf,
recvQuota: initialWindowSize,
id: frame.Header().StreamID,
st: t,
buf: buf,
recvQuota: initialWindowSize,
}
endStream := frame.Header().Flags.Has(http2.FlagHeadersEndStream)
curStream = t.operateHeaders(hDec, curStream, frame, endStream, handle, &wg)

Просмотреть файл

@ -55,7 +55,7 @@ const (
// http://http2.github.io/http2-spec/#SettingValues
http2InitHeaderTableSize = 4096
// http2IOBufSize specifies the buffer size for sending frames.
http2IOBufSize = 32 * 1024
http2IOBufSize = 32 * 1024
)
var (