MCPcopy
hub / github.com/valyala/fasthttp / hijackConnHandler

Function hijackConnHandler

server.go:2763–2777  ·  view source on GitHub ↗
(ctx *RequestCtx, r io.Reader, c net.Conn, s *Server, h HijackHandler)

Source from the content-addressed store, hash-verified

2761}
2762
2763func hijackConnHandler(ctx *RequestCtx, r io.Reader, c net.Conn, s *Server, h HijackHandler) {
2764 hjc := s.acquireHijackConn(r, c)
2765 h(hjc)
2766
2767 // When the caller keeps using the hijacked connection after return,
2768 // the buffered reader must remain owned by that escaped connection.
2769 if br, ok := r.(*bufio.Reader); ok && !s.KeepHijackedConns {
2770 releaseReader(s, br)
2771 }
2772 if !s.KeepHijackedConns {
2773 c.Close()
2774 s.releaseHijackConn(hjc)
2775 }
2776 s.releaseCtx(ctx)
2777}
2778
2779func (s *Server) acquireHijackConn(r io.Reader, c net.Conn) *hijackConn {
2780 v := s.hijackConnPool.Get()

Calls 5

releaseReaderFunction · 0.85
acquireHijackConnMethod · 0.80
releaseHijackConnMethod · 0.80
releaseCtxMethod · 0.80
CloseMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…