handleRawConn forks a goroutine to handle a just-accepted connection that has not had any I/O performed on it yet.
(lisAddr string, rawConn net.Conn)
| 980 | // handleRawConn forks a goroutine to handle a just-accepted connection that |
| 981 | // has not had any I/O performed on it yet. |
| 982 | func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) { |
| 983 | if s.quit.HasFired() { |
| 984 | rawConn.Close() |
| 985 | return |
| 986 | } |
| 987 | rawConn.SetDeadline(time.Now().Add(s.opts.connectionTimeout)) |
| 988 | |
| 989 | // Finish handshaking (HTTP2) |
| 990 | st := s.newHTTP2Transport(rawConn) |
| 991 | rawConn.SetDeadline(time.Time{}) |
| 992 | if st == nil { |
| 993 | return |
| 994 | } |
| 995 | |
| 996 | if cc, ok := rawConn.(interface { |
| 997 | PassServerTransport(transport.ServerTransport) |
| 998 | }); ok { |
| 999 | cc.PassServerTransport(st) |
| 1000 | } |
| 1001 | |
| 1002 | if !s.addConn(lisAddr, st) { |
| 1003 | return |
| 1004 | } |
| 1005 | go func() { |
| 1006 | s.serveStreams(context.Background(), st, rawConn) |
| 1007 | s.removeConn(lisAddr, st) |
| 1008 | }() |
| 1009 | } |
| 1010 | |
| 1011 | // newHTTP2Transport sets up a http/2 transport (using the |
| 1012 | // gRPC http2 server transport in transport/http2_server.go). |
no test coverage detected