aboutsummaryrefslogtreecommitdiffstats
path: root/core/connection.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-07-10 07:14:20 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-07-10 07:14:20 +0200
commit4dca07c803308611275f78b490ac0352c1052fe2 (patch)
treeefb52ff663ef3b16f4bd6957379a572c5fd49de0 /core/connection.go
parentb1006dced4cc0c23d9dc754e97d89500aeb55170 (diff)
Fix socketclient for VPP 19.08
- in VPP 19.08 the socket type has changed to STREAM and data has to be writtento VPP with single flush, otherwise msg might get mixed with next header and cause VPP to stop responding - this also fixes WaitReady for socketclient and vppapiclient Change-Id: I022724c0c09c9b92d4c695d1cf2be15994fff717 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'core/connection.go')
-rw-r--r--core/connection.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/connection.go b/core/connection.go
index 02f980a..605e1ef 100644
--- a/core/connection.go
+++ b/core/connection.go
@@ -30,8 +30,8 @@ import (
)
const (
- DefaultReconnectInterval = time.Second // default interval between reconnect attempts
- DefaultMaxReconnectAttempts = 3 // default maximum number of reconnect attempts
+ DefaultReconnectInterval = time.Second / 2 // default interval between reconnect attempts
+ DefaultMaxReconnectAttempts = 3 // default maximum number of reconnect attempts
)
var (
@@ -255,7 +255,7 @@ func (c *Connection) releaseAPIChannel(ch *Channel) {
// connectLoop attempts to connect to VPP until it succeeds.
// Then it continues with healthCheckLoop.
func (c *Connection) connectLoop(connChan chan ConnectionEvent) {
- reconnectAttempts := 0
+ var reconnectAttempts int
// loop until connected
for {
@@ -268,7 +268,7 @@ func (c *Connection) connectLoop(connChan chan ConnectionEvent) {
break
} else if reconnectAttempts < c.maxAttempts {
reconnectAttempts++
- log.Errorf("connecting failed (attempt %d/%d): %v", reconnectAttempts, c.maxAttempts, err)
+ log.Warnf("connecting failed (attempt %d/%d): %v", reconnectAttempts, c.maxAttempts, err)
time.Sleep(c.recInterval)
} else {
connChan <- ConnectionEvent{Timestamp: time.Now(), State: Failed, Error: err}