mirror of
https://github.com/fosrl/newt.git
synced 2026-03-26 12:36:45 +00:00
Clean up to match olm
This commit is contained in:
@@ -661,15 +661,7 @@ func (c *Client) setupPKCS12TLS() (*tls.Config, error) {
|
||||
}
|
||||
|
||||
// pingMonitor sends pings at a short interval and triggers reconnect on failure
|
||||
func (c *Client) pingMonitor() {
|
||||
ticker := time.NewTicker(c.pingInterval)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-c.done:
|
||||
return
|
||||
case <-ticker.C:
|
||||
func (c *Client) sendPing() {
|
||||
if c.conn == nil {
|
||||
return
|
||||
}
|
||||
@@ -680,7 +672,7 @@ func (c *Client) pingMonitor() {
|
||||
c.processingMux.RUnlock()
|
||||
if isProcessing {
|
||||
logger.Debug("Skipping ping, message is being processed")
|
||||
continue
|
||||
return
|
||||
}
|
||||
|
||||
c.configVersionMux.RLock()
|
||||
@@ -714,6 +706,21 @@ func (c *Client) pingMonitor() {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) pingMonitor() {
|
||||
// Send an immediate ping as soon as we connect
|
||||
c.sendPing()
|
||||
|
||||
ticker := time.NewTicker(c.pingInterval)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-c.done:
|
||||
return
|
||||
case <-ticker.C:
|
||||
c.sendPing()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user