aboutsummaryrefslogtreecommitdiff
path: root/pkg/ipstack
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-10-09 12:54:59 -0400
committersotech117 <michael_foiani@brown.edu>2023-10-09 12:54:59 -0400
commitf81bfd8b8e1c663d40bcc0f2ce9fb114a204f8d7 (patch)
tree17d4b3922eeedfdde09c180dd24b5cca84ab6882 /pkg/ipstack
parent365548a29f23f15632305d65070236cfd270589c (diff)
small changes
Diffstat (limited to 'pkg/ipstack')
-rw-r--r--pkg/ipstack/ipstack.go4
-rw-r--r--pkg/ipstack/ipstack_test.go2
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")