logger "github.com/sirupsen/logrus"
)
+var ReplyChannelTimeout = time.Millisecond * 100
+
var (
ErrNotConnected = errors.New("not connected to VPP, ignoring the request")
ErrProbeTimeout = errors.New("probe reply not received within timeout period")
"context": context,
"is_multi": req.multi,
"msg_id": msgID,
- "msg_name": req.msg.GetMessageName(),
"msg_size": len(data),
"seq_num": req.seqNum,
- }).Debug(" -> Sending a message to VPP.")
+ "msg_crc": req.msg.GetCrcString(),
+ }).Debugf("--> govpp send: %s: %+v", req.msg.GetMessageName(), req.msg)
}
// send the request to VPP
"msg_id": c.pingReqID,
"msg_size": len(pingData),
"seq_num": req.seqNum,
- }).Debug(" -> Sending a control ping to VPP.")
+ }).Debug(" -> sending control ping")
if err := c.vppClient.SendMsg(context, pingData); err != nil {
log.WithFields(logger.Fields{
// msgCallback is called whenever any binary API message comes from VPP.
func (c *Connection) msgCallback(msgID uint16, data []byte) {
- connLock.RLock()
- defer connLock.RUnlock()
-
if c == nil {
log.Warn("Already disconnected, ignoring the message.")
return
log.WithFields(logger.Fields{
"context": context,
"msg_id": msgID,
- "msg_name": msg.GetMessageName(),
"msg_size": len(data),
"channel": chanID,
"is_multi": isMulti,
"seq_num": seqNum,
- }).Debug(" <- Received a message from VPP.")
+ "msg_crc": msg.GetCrcString(),
+ }).Debugf("<-- govpp recv: %s", msg.GetMessageName())
}
if context == 0 || c.isNotificationMessage(msgID) {
select {
case ch.replyChan <- reply:
// reply sent successfully
- case <-time.After(time.Millisecond * 100):
+ case <-time.After(ReplyChannelTimeout):
// receiver still not ready
log.WithFields(logger.Fields{
"channel": ch,