Serve serves an HTTP2 server that the edge can talk to.
(ctx context.Context)
| 76 | |
| 77 | // Serve serves an HTTP2 server that the edge can talk to. |
| 78 | func (c *HTTP2Connection) Serve(ctx context.Context) error { |
| 79 | go func() { |
| 80 | <-ctx.Done() |
| 81 | c.close() |
| 82 | }() |
| 83 | c.server.ServeConn(c.conn, &http2.ServeConnOpts{ |
| 84 | Context: ctx, |
| 85 | Handler: c, |
| 86 | }) |
| 87 | |
| 88 | switch { |
| 89 | case c.controlStreamHandler.IsStopped(): |
| 90 | return nil |
| 91 | case c.controlStreamErr != nil: |
| 92 | return c.controlStreamErr |
| 93 | default: |
| 94 | c.observer.log.Info().Uint8(LogFieldConnIndex, c.connIndex).Msg("Lost connection with the edge") |
| 95 | return errEdgeConnectionClosed |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | func (c *HTTP2Connection) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 100 | c.activeRequestsWG.Add(1) |
no test coverage detected