MCPcopy
hub / github.com/wavetermdev/waveterm / registerConn

Function registerConn

pkg/web/ws.go:222–237  ·  view source on GitHub ↗
(wsConnId string, stableId string, wproxy *wshutil.WshRpcProxy)

Source from the content-addressed store, hash-verified

220}
221
222func registerConn(wsConnId string, stableId string, wproxy *wshutil.WshRpcProxy) {
223 GlobalLock.Lock()
224 defer GlobalLock.Unlock()
225 curConnInfo := RouteToConnMap[stableId]
226 if curConnInfo != nil {
227 log.Printf("[websocket] warning: replacing existing connection for stableid %q\n", stableId)
228 if curConnInfo.LinkId != baseds.NoLinkId {
229 wshutil.DefaultRouter.UnregisterLink(curConnInfo.LinkId)
230 }
231 }
232 linkId := wshutil.DefaultRouter.RegisterTrustedRouter(wproxy)
233 RouteToConnMap[stableId] = &StableConnInfo{
234 ConnId: wsConnId,
235 LinkId: linkId,
236 }
237}
238
239func unregisterConn(wsConnId string, stableId string) {
240 GlobalLock.Lock()

Callers 1

HandleWsInternalFunction · 0.85

Calls 2

UnregisterLinkMethod · 0.80
RegisterTrustedRouterMethod · 0.80

Tested by

no test coverage detected