From c51fc8804d1ccfbb08fdbad070a34a39a2966573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Tue, 23 Jan 2024 11:16:53 +0100 Subject: [PATCH 1/2] Use correct API to get timer channel in trex-emu-proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Svensson --- src/cmd-proxy/trex-emu-proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd-proxy/trex-emu-proxy.go b/src/cmd-proxy/trex-emu-proxy.go index 4029902..88a2376 100644 --- a/src/cmd-proxy/trex-emu-proxy.go +++ b/src/cmd-proxy/trex-emu-proxy.go @@ -172,7 +172,7 @@ func (o *CZmqProxy) MainLoop() { select { case pkt := <-o.rawSocket.GetC(): // raw socket rx -> send to veth o.OnRxPkt(pkt) - case <-o.tctx.C(): // timer flush + case <-o.tctx.GetTimerCtx().GetC(): // timer flush o.tctx.HandleMainTimerTicks() case msg := <-o.tctx.Veth.GetC(): // zmq -> raw_socket o.tctx.Veth.OnRxStream(msg) // call HandleRxPacket From 1e6921a422275c0f72800dab6d80cf458b0e68ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Tue, 23 Jan 2024 11:19:52 +0100 Subject: [PATCH 2/2] Remove unused or unreachable code in trex-emu-proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes following issues indicated by golangci-lint: cmd-proxy/trex-emu-proxy.go:33:2: field `port` is unused (unused) port *int ^ cmd-proxy/trex-emu-proxy.go:182:2: unreachable: unreachable code (govet) o.tctx.Veth.SimulatorCleanup() ^ No need for cleanups after the MainLoop since when the proxy process is terminated from shell the program will exit (no signal handling exist). Signed-off-by: Björn Svensson --- src/cmd-proxy/trex-emu-proxy.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/cmd-proxy/trex-emu-proxy.go b/src/cmd-proxy/trex-emu-proxy.go index 88a2376..b84cd9f 100644 --- a/src/cmd-proxy/trex-emu-proxy.go +++ b/src/cmd-proxy/trex-emu-proxy.go @@ -30,7 +30,6 @@ const ( ) type MainArgs struct { - port *int vethPort *int verbose *bool monitor *bool @@ -179,8 +178,6 @@ func (o *CZmqProxy) MainLoop() { } o.tctx.Veth.FlushTx() } - o.tctx.Veth.SimulatorCleanup() - o.tctx.MPool.ClearCache() } func RunCoreZmq(args *MainArgs) {