MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / acceptMuxConnections

Method acceptMuxConnections

internal/api/protocol_multiplexer.go:38–59  ·  view source on GitHub ↗
(listener net.Listener, httpListener *muxListener)

Source from the content-addressed store, hash-verified

36}
37
38func (s *Server) acceptMuxConnections(listener net.Listener, httpListener *muxListener) error {
39 if s == nil || listener == nil {
40 return net.ErrClosed
41 }
42
43 for {
44 conn, errAccept := listener.Accept()
45 if errAccept != nil {
46 return errAccept
47 }
48 if conn == nil {
49 continue
50 }
51
52 // Dispatch each connection to a goroutine so that slow/idle clients
53 // cannot block the accept loop. Previously, TLS handshake and
54 // reader.Peek(1) were performed inline; an idle TCP connection that
55 // never sent bytes would block Peek indefinitely, preventing all
56 // subsequent connections from being accepted (issue #3267).
57 go s.routeMuxConnection(conn, httpListener)
58 }
59}
60
61// routeMuxConnection performs per-connection protocol detection and routing.
62func (s *Server) routeMuxConnection(conn net.Conn, httpListener *muxListener) {

Callers 3

StartMethod · 0.95
startRedisMuxListenerFunction · 0.80

Calls 2

routeMuxConnectionMethod · 0.95
AcceptMethod · 0.80

Tested by 2

startRedisMuxListenerFunction · 0.64