From 48198748bdfcc7d30c794cdac19de822da53f840 Mon Sep 17 00:00:00 2001 From: Ravi Raju Date: Mon, 9 Sep 2019 18:23:56 -0700 Subject: add MockClearReplyHandlers() api for mock vpp adapter Change-Id: I12285c77c9cf09a24c957a777b26ae54f082f317 Signed-off-by: Ravi Raju --- adapter/mock/mock_vpp_adapter.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'adapter/mock/mock_vpp_adapter.go') diff --git a/adapter/mock/mock_vpp_adapter.go b/adapter/mock/mock_vpp_adapter.go index 9dca2ba..c05148d 100644 --- a/adapter/mock/mock_vpp_adapter.go +++ b/adapter/mock/mock_vpp_adapter.go @@ -372,6 +372,16 @@ func (a *VppAdapter) MockReplyHandler(replyHandler ReplyHandler) { a.mode = useReplyHandlers } +// MockClearReplyHanders clears all reply handlers that were registered +// Will also set the mode to useReplyHandlers +func (a *VppAdapter) MockClearReplyHandlers () { + a.repliesLock.Lock() + defer a.repliesLock.Unlock() + + a.replyHandlers = a.replyHandlers[:0] + a.mode = useReplyHandlers +} + func setSeqNum(context uint32, seqNum uint16) (newContext uint32) { context &= 0xffff0000 context |= uint32(seqNum) -- cgit 1.2.3-korg