MCPcopy Create free account
hub / github.com/cloudbase/garm / Register

Method Register

websocket/websocket.go:93–108  ·  view source on GitHub ↗
(client *Client)

Source from the content-addressed store, hash-verified

91}
92
93func (h *Hub) Register(client *Client) error {
94 if client == nil {
95 return nil
96 }
97 h.mux.Lock()
98 defer h.mux.Unlock()
99 cli, ok := h.clients[client.ID()]
100 if ok {
101 if cli != nil {
102 return fmt.Errorf("client already registered")
103 }
104 }
105 slog.DebugContext(h.ctx, "registering client", "client_id", client.ID())
106 h.clients[client.id] = client
107 return nil
108}
109
110func (h *Hub) Unregister(client *Client) error {
111 if client == nil {

Callers 3

RegisterMetricsFunction · 0.45
MetricsHandlerMethod · 0.45
WSHandlerMethod · 0.45

Calls 3

LockMethod · 0.65
UnlockMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected