MCPcopy Create free account
hub / github.com/PasarGuard/node / Connect

Method Connect

controller/controller.go:55–67  ·  view source on GitHub ↗
(ip string, keepAlive uint64)

Source from the content-addressed store, hash-verified

53}
54
55func (c *Controller) Connect(ip string, keepAlive uint64) {
56 c.mu.Lock()
57 defer c.mu.Unlock()
58 c.lastRequest = time.Now()
59 c.clientIP = ip
60
61 ctx, cancel := context.WithCancel(context.Background())
62 c.cancelFunc = cancel
63 go c.recordSystemStats(ctx)
64 if keepAlive > 0 {
65 go c.keepAliveTracker(ctx, time.Duration(keepAlive)*time.Second)
66 }
67}
68
69func (c *Controller) Disconnect() {
70 c.cancelFunc()

Callers 2

StartMethod · 0.80
StartMethod · 0.80

Calls 2

recordSystemStatsMethod · 0.95
keepAliveTrackerMethod · 0.95

Tested by

no test coverage detected