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

Method checkConnection

pkg/remote/conncontroller/connmonitor.go:133–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131}
132
133func (cm *ConnMonitor) checkConnection() {
134 lastActivity := cm.LastActivityTime.Load()
135 if lastActivity == 0 {
136 return
137 }
138 urgent := cm.isUrgent()
139 timeSinceActivity := time.Now().UnixMilli() - lastActivity
140
141 keepAliveThreshold := int64(10000)
142 if urgent {
143 keepAliveThreshold = 1000
144 }
145 if timeSinceActivity > keepAliveThreshold {
146 cm.SendKeepAlive()
147 }
148
149 stalledThreshold := int64(10000)
150 if urgent {
151 stalledThreshold = 5000
152 }
153 timeSinceKeepAlive := cm.getTimeSinceKeepAlive()
154 if timeSinceKeepAlive > stalledThreshold {
155 cm.setConnHealthStatus(ConnHealthStatus_Stalled)
156 }
157}
158
159func (cm *ConnMonitor) keepAliveMonitor() {
160 defer func() {

Callers 1

keepAliveMonitorMethod · 0.95

Calls 4

isUrgentMethod · 0.95
SendKeepAliveMethod · 0.95
getTimeSinceKeepAliveMethod · 0.95
setConnHealthStatusMethod · 0.95

Tested by

no test coverage detected