From df05a70f90a1486a86a4156b1b0d68c94f2098b4 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Fri, 8 Feb 2019 08:38:56 +0100 Subject: Add support for using multiple generated versions - added CheckCompatibility for checking if given messages are compatible - generating Messages global for easier usage of compatibility check - added ReconnectInterval and MaxReconnectAttempts for reconnecting - added Failed state that is sent after exceeding max reconnect attempts Change-Id: I1062ba453f22657c1a2a31aa64cb103ef1223b0f Signed-off-by: Ondrej Fabry --- api/api.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'api/api.go') diff --git a/api/api.go b/api/api.go index 3e4eb0b..ac9f8a4 100644 --- a/api/api.go +++ b/api/api.go @@ -15,7 +15,6 @@ package api import ( - "fmt" "time" ) @@ -89,6 +88,10 @@ type Channel interface { // from VPP before returning an error. SetReplyTimeout(timeout time.Duration) + // CheckCompatibility checks the compatiblity for the given messages. + // It will return an error if any of the given messages are not compatible. + CheckCompatiblity(msgs ...Message) error + // Close closes the API channel and releases all API channel-related resources in the ChannelProvider. Close() } @@ -119,9 +122,10 @@ var registeredMessages = make(map[string]Message) // RegisterMessage is called from generated code to register message. func RegisterMessage(x Message, name string) { - if _, ok := registeredMessages[name]; ok { + name = x.GetMessageName() + "_" + x.GetCrcString() + /*if _, ok := registeredMessages[name]; ok { panic(fmt.Errorf("govpp: duplicate message registered: %s (%s)", name, x.GetCrcString())) - } + }*/ registeredMessages[name] = x } -- cgit 1.2.3-korg