|
@@ -9,6 +9,34 @@
|
|
|
// instead, and make sure that on close we close all open
|
|
// instead, and make sure that on close we close all open
|
|
|
// streams. then remove doneServing?
|
|
// streams. then remove doneServing?
|
|
|
|
|
|
|
|
|
|
+// TODO: finish GOAWAY support. Consider each incoming frame type and
|
|
|
|
|
+// whether it should be ignored during a shutdown race.
|
|
|
|
|
+
|
|
|
|
|
+// TODO: disconnect idle clients. GFE seems to do 4 minutes. make
|
|
|
|
|
+// configurable? or maximum number of idle clients and remove the
|
|
|
|
|
+// oldest?
|
|
|
|
|
+
|
|
|
|
|
+// TODO: turn off the serve goroutine when idle, so
|
|
|
|
|
+// an idle conn only has the readFrames goroutine active. (which could
|
|
|
|
|
+// also be optimized probably to pin less memory in crypto/tls). This
|
|
|
|
|
+// would involve tracking when the serve goroutine is active (atomic
|
|
|
|
|
+// int32 read/CAS probably?) and starting it up when frames arrive,
|
|
|
|
|
+// and shutting it down when all handlers exit. the occasional PING
|
|
|
|
|
+// packets could use time.AfterFunc to call sc.wakeStartServeLoop()
|
|
|
|
|
+// (which is a no-op if already running) and then queue the PING write
|
|
|
|
|
+// as normal. The serve loop would then exit in most cases (if no
|
|
|
|
|
+// Handlers running) and not be woken up again until the PING packet
|
|
|
|
|
+// returns.
|
|
|
|
|
+
|
|
|
|
|
+// TODO (maybe): add a mechanism for Handlers to going into
|
|
|
|
|
+// half-closed-local mode (rw.(io.Closer) test?) but not exit their
|
|
|
|
|
+// handler, and continue to be able to read from the
|
|
|
|
|
+// Request.Body. This would be a somewhat semantic change from HTTP/1
|
|
|
|
|
+// (or at least what we expose in net/http), so I'd probably want to
|
|
|
|
|
+// add it there too. For now, this package says that returning from
|
|
|
|
|
+// the Handler ServeHTTP function means you're both done reading and
|
|
|
|
|
+// done writing, without a way to stop just one or the other.
|
|
|
|
|
+
|
|
|
package http2
|
|
package http2
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
@@ -59,34 +87,6 @@ var (
|
|
|
testHookOnPanic func(sc *serverConn, panicVal interface{}) (rePanic bool)
|
|
testHookOnPanic func(sc *serverConn, panicVal interface{}) (rePanic bool)
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-// TODO: finish GOAWAY support. Consider each incoming frame type and
|
|
|
|
|
-// whether it should be ignored during a shutdown race.
|
|
|
|
|
-
|
|
|
|
|
-// TODO: disconnect idle clients. GFE seems to do 4 minutes. make
|
|
|
|
|
-// configurable? or maximum number of idle clients and remove the
|
|
|
|
|
-// oldest?
|
|
|
|
|
-
|
|
|
|
|
-// TODO: turn off the serve goroutine when idle, so
|
|
|
|
|
-// an idle conn only has the readFrames goroutine active. (which could
|
|
|
|
|
-// also be optimized probably to pin less memory in crypto/tls). This
|
|
|
|
|
-// would involve tracking when the serve goroutine is active (atomic
|
|
|
|
|
-// int32 read/CAS probably?) and starting it up when frames arrive,
|
|
|
|
|
-// and shutting it down when all handlers exit. the occasional PING
|
|
|
|
|
-// packets could use time.AfterFunc to call sc.wakeStartServeLoop()
|
|
|
|
|
-// (which is a no-op if already running) and then queue the PING write
|
|
|
|
|
-// as normal. The serve loop would then exit in most cases (if no
|
|
|
|
|
-// Handlers running) and not be woken up again until the PING packet
|
|
|
|
|
-// returns.
|
|
|
|
|
-
|
|
|
|
|
-// TODO (maybe): add a mechanism for Handlers to going into
|
|
|
|
|
-// half-closed-local mode (rw.(io.Closer) test?) but not exit their
|
|
|
|
|
-// handler, and continue to be able to read from the
|
|
|
|
|
-// Request.Body. This would be a somewhat semantic change from HTTP/1
|
|
|
|
|
-// (or at least what we expose in net/http), so I'd probably want to
|
|
|
|
|
-// add it there too. For now, this package says that returning from
|
|
|
|
|
-// the Handler ServeHTTP function means you're both done reading and
|
|
|
|
|
-// done writing, without a way to stop just one or the other.
|
|
|
|
|
-
|
|
|
|
|
// Server is an HTTP/2 server.
|
|
// Server is an HTTP/2 server.
|
|
|
type Server struct {
|
|
type Server struct {
|
|
|
// MaxHandlers limits the number of http.Handler ServeHTTP goroutines
|
|
// MaxHandlers limits the number of http.Handler ServeHTTP goroutines
|