(ip string, keepAlive uint64)
| 53 | } |
| 54 | |
| 55 | func (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 | |
| 69 | func (c *Controller) Disconnect() { |
| 70 | c.cancelFunc() |
no test coverage detected