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

Function isSocketAvailable

agent/agentsocket/socket_unix.go:51–64  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

49}
50
51func isSocketAvailable(path string) bool {
52 if _, err := os.Stat(path); os.IsNotExist(err) {
53 return true
54 }
55
56 // Try to connect to see if it's actually listening.
57 dialer := net.Dialer{Timeout: 10 * time.Second}
58 conn, err := dialer.Dial("unix", path)
59 if err != nil {
60 return true
61 }
62 _ = conn.Close()
63 return false
64}
65
66func dialSocket(ctx context.Context, path string) (net.Conn, error) {
67 if path == "" {

Callers 1

createSocketFunction · 0.85

Calls 2

DialMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected