MCPcopy Index your code
hub / github.com/coder/coder / acceptConnections

Method acceptConnections

agent/agentsocket/server.go:135–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

133}
134
135func (s *Server) acceptConnections() {
136 // In an edge case, Close() might race with acceptConnections() and set s.listener to nil.
137 // Therefore, we grab a copy of the listener under a lock. We might still get a nil listener,
138 // but then we know close has already run and we can return early.
139 s.mu.Lock()
140 listener := s.listener
141 s.mu.Unlock()
142 if listener == nil {
143 return
144 }
145
146 err := s.drpcServer.Serve(s.ctx, listener)
147 if err != nil {
148 s.logger.Warn(s.ctx, "error serving drpc server", slog.Error(err))
149 }
150}

Callers 1

NewServerFunction · 0.95

Calls 4

LockMethod · 0.45
UnlockMethod · 0.45
ServeMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected