summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRastislav Szabo <raszabo@cisco.com>2017-05-17 16:19:30 +0200
committerRastislav Szabo <raszabo@cisco.com>2017-05-17 16:19:30 +0200
commit4b0cfc7539ec6fdbc462f60269656fee761bafaf (patch)
tree27a9f634d5201dea49207a50fa8e1ba9639bdc58 /api
parent51f628282c65f754152a346074f2ae286121138e (diff)
multiple small fixes
Change-Id: I9e822ce7e9b9f44f7d074b0294d6eda37c2a0f12 Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Diffstat (limited to 'api')
-rw-r--r--api/api.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/api/api.go b/api/api.go
index 783f97a..f478bf1 100644
--- a/api/api.go
+++ b/api/api.go
@@ -78,7 +78,8 @@ type MessageIdentifier interface {
// Channel is the main communication interface with govpp core. It contains two Go channels, one for sending the requests
// to VPP and one for receiving the replies from it. The user can access the Go channels directly, or use the helper
-// methods provided inside of this package.
+// methods provided inside of this package. Do not use the same channel from multiple goroutines concurrently,
+// otherwise the responses could mix! Use multiple channels instead.
type Channel struct {
ReqChan chan *VppRequest // channel for sending the requests to VPP, closing this channel releases all resources in the ChannelProvider
ReplyChan chan *VppReply // channel where VPP replies are delivered to
@@ -230,7 +231,8 @@ func (ch *Channel) receiveReplyInternal(msg Message) (LastReplyReceived bool, er
return false, err
}
if vppReply.MessageID != expMsgID {
- err = fmt.Errorf("invalid message ID %d, expected %d", vppReply.MessageID, expMsgID)
+ err = fmt.Errorf("invalid message ID %d, expected %d "+
+ "(also check if multiple goroutines are not sharing one GoVPP channel)", vppReply.MessageID, expMsgID)
return false, err
}
// decode the message