From 8adb6cdcb496f05169263d32a857791faf8baee1 Mon Sep 17 00:00:00 2001 From: Milan Lenco Date: Mon, 25 Jun 2018 20:31:11 +0200 Subject: Pair requests with replies using sequence numbers Requests are given sequence numbers (cycling over a finite set of 2^16 integers) that are stored into the lower 16bits of the context. 1bit is also allocated for isMultipart boolean flag and the remaining 15bits are used to store the channel ID. The sequence numbers allow to reliably pair replies with requests, even in scenarious with timeouted requests or ignored (unread) replies. Sequencing is not used with asynchronous messaging as it is implemented by methods of the Channel structure, i.e. above ReqChan and ReplyChan channels. Change-Id: I7ca0e8489c7ffcc388c3cfef6d05c02f9500931c Signed-off-by: Milan Lenco --- adapter/vppapiclient/vppapiclient_adapter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'adapter/vppapiclient') diff --git a/adapter/vppapiclient/vppapiclient_adapter.go b/adapter/vppapiclient/vppapiclient_adapter.go index 5a05a58..c77d7f1 100644 --- a/adapter/vppapiclient/vppapiclient_adapter.go +++ b/adapter/vppapiclient/vppapiclient_adapter.go @@ -145,8 +145,8 @@ func (a *vppAPIClientAdapter) GetMsgID(msgName string, msgCrc string) (uint16, e } // SendMsg sends a binary-encoded message to VPP. -func (a *vppAPIClientAdapter) SendMsg(clientID uint32, data []byte) error { - rc := C.govpp_send(C.uint32_t(clientID), unsafe.Pointer(&data[0]), C.size_t(len(data))) +func (a *vppAPIClientAdapter) SendMsg(context uint32, data []byte) error { + rc := C.govpp_send(C.uint32_t(context), unsafe.Pointer(&data[0]), C.size_t(len(data))) if rc != 0 { return fmt.Errorf("unable to send the message (error=%d)", rc) } -- cgit 1.2.3-korg