From 392a56b700fa6715d091e56c49f79bfe32613fc6 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Thu, 5 Apr 2018 13:46:54 +0200 Subject: Lookup message name by ID when receiving unexpected message Change-Id: I693e8084b7e3f036dec5e557dc772857bb7d5f3d Signed-off-by: Ondrej Fabry --- core/core.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/core.go') diff --git a/core/core.go b/core/core.go index b912715..ebe7f68 100644 --- a/core/core.go +++ b/core/core.go @@ -73,14 +73,14 @@ type Connection struct { connected uint32 // non-zero if the adapter is connected to VPP codec *MsgCodec // message codec - msgIDs map[string]uint16 // map of message IDs indexed by message name + CRC msgIDsLock sync.RWMutex // lock for the message IDs map + msgIDs map[string]uint16 // map of message IDs indexed by message name + CRC - channels map[uint32]*api.Channel // map of all API channels indexed by the channel ID channelsLock sync.RWMutex // lock for the channels map + channels map[uint32]*api.Channel // map of all API channels indexed by the channel ID - notifSubscriptions map[uint16][]*api.NotifSubscription // map od all notification subscriptions indexed by message ID notifSubscriptionsLock sync.RWMutex // lock for the subscriptions map + notifSubscriptions map[uint16][]*api.NotifSubscription // map od all notification subscriptions indexed by message ID maxChannelID uint32 // maximum used client ID pingReqID uint16 // ID if the ControlPing message @@ -306,7 +306,7 @@ func (c *Connection) healthCheckLoop(connChan chan ConnectionEvent) { failedChecks = 0 } - if failedChecks >= healthCheckThreshold { + if failedChecks > healthCheckThreshold { // in case of error, break & disconnect log.Errorf("VPP health check failed: %v", err) // signal disconnected event via channel -- cgit 1.2.3-korg