summaryrefslogtreecommitdiffstats
path: root/core/request_handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/request_handler.go')
-rw-r--r--core/request_handler.go31
1 files changed, 16 insertions, 15 deletions
diff --git a/core/request_handler.go b/core/request_handler.go
index dc02ee7..4a62754 100644
--- a/core/request_handler.go
+++ b/core/request_handler.go
@@ -48,34 +48,34 @@ func (c *Connection) watchRequests(ch *api.Channel, chMeta *channelMetadata) {
func (c *Connection) processRequest(ch *api.Channel, chMeta *channelMetadata, req *api.VppRequest) error {
// check whether we are connected to VPP
if atomic.LoadUint32(&c.connected) == 0 {
- error := errors.New("not connected to VPP, ignoring the request")
- log.Error(error)
- sendReply(ch, &api.VppReply{Error: error})
- return error
+ err := errors.New("not connected to VPP, ignoring the request")
+ log.Error(err)
+ sendReply(ch, &api.VppReply{Error: err})
+ return err
}
// retrieve message ID
msgID, err := c.GetMessageID(req.Message)
if err != nil {
- error := fmt.Errorf("unable to retrieve message ID: %v", err)
+ err = fmt.Errorf("unable to retrieve message ID: %v", err)
log.WithFields(logger.Fields{
"msg_name": req.Message.GetMessageName(),
"msg_crc": req.Message.GetCrcString(),
- }).Error(error)
- sendReply(ch, &api.VppReply{Error: error})
- return error
+ }).Error(err)
+ sendReply(ch, &api.VppReply{Error: err})
+ return err
}
// encode the message into binary
data, err := c.codec.EncodeMsg(req.Message, msgID)
if err != nil {
- error := fmt.Errorf("unable to encode the messge: %v", err)
+ err = fmt.Errorf("unable to encode the messge: %v", err)
log.WithFields(logger.Fields{
"context": chMeta.id,
"msg_id": msgID,
- }).Error(error)
- sendReply(ch, &api.VppReply{Error: error})
- return error
+ }).Error(err)
+ sendReply(ch, &api.VppReply{Error: err})
+ return err
}
if log.Level == logger.DebugLevel { // for performance reasons - logrus does some processing even if debugs are disabled
@@ -83,6 +83,7 @@ func (c *Connection) processRequest(ch *api.Channel, chMeta *channelMetadata, re
"context": chMeta.id,
"msg_id": msgID,
"msg_size": len(data),
+ "msg_name": req.Message.GetMessageName(),
}).Debug("Sending a message to VPP.")
}
@@ -199,12 +200,12 @@ func (c *Connection) messageNameToID(msgName string, msgCrc string) (uint16, err
// get the ID using VPP API
id, err := c.vpp.GetMsgID(msgName, msgCrc)
if err != nil {
- error := fmt.Errorf("unable to retrieve message ID: %v", err)
+ err = fmt.Errorf("unable to retrieve message ID: %v", err)
log.WithFields(logger.Fields{
"msg_name": msgName,
"msg_crc": msgCrc,
- }).Error(error)
- return id, error
+ }).Error(err)
+ return id, err
}
c.msgIDsLock.Lock()