MCPcopy Create free account
hub / github.com/PostHog/duckgres / acceptLoop

Method acceptLoop

tests/integration/latency_proxy.go:58–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56}
57
58func (p *LatencyProxy) acceptLoop() {
59 for {
60 client, err := p.listener.Accept()
61 if err != nil {
62 return
63 }
64
65 p.mu.Lock()
66 if p.closed {
67 p.mu.Unlock()
68 _ = client.Close()
69 return
70 }
71 p.conns = append(p.conns, client)
72 p.mu.Unlock()
73
74 go p.handleConn(client)
75 }
76}
77
78func (p *LatencyProxy) handleConn(client net.Conn) {
79 upstream, err := net.DialTimeout("tcp", p.target, 5*time.Second)

Callers 1

NewLatencyProxyFunction · 0.95

Calls 2

handleConnMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected