From f81bfd8b8e1c663d40bcc0f2ce9fb114a204f8d7 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Mon, 9 Oct 2023 12:54:59 -0400 Subject: small changes --- pkg/ipstack/ipstack.go | 4 +++- pkg/ipstack/ipstack_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/ipstack/ipstack.go b/pkg/ipstack/ipstack.go index c993a7d..446bbff 100644 --- a/pkg/ipstack/ipstack.go +++ b/pkg/ipstack/ipstack.go @@ -373,7 +373,9 @@ func CleanUp() { fmt.Print("Cleaning up...\n") // go through the interfaces, pop thread & close the UDP FDs for _, iface := range myInterfaces { - close(iface.SocketChannel) + if iface.SocketChannel != nil { + close(iface.SocketChannel) + } iface.RecvSocket.Close() } diff --git a/pkg/ipstack/ipstack_test.go b/pkg/ipstack/ipstack_test.go index ddb5453..ae71bba 100644 --- a/pkg/ipstack/ipstack_test.go +++ b/pkg/ipstack/ipstack_test.go @@ -82,8 +82,8 @@ func TestInterfaceUpThenDownTwice(t *testing.T) { } time.Sleep(3 * time.Millisecond) - fmt.Println("putting interface back up") + fmt.Println("putting interface back up for 3 iterations") InterfaceUp(iface) if iface.State == false { t.Error("iface state should be true") -- cgit v1.2.3-70-g09d2