Skip to content

Commit

Permalink
fix issue with survival of nebula service from previous testrun
Browse files Browse the repository at this point in the history
  • Loading branch information
cre4ture committed Sep 15, 2024
1 parent 352f74f commit 84d1a26
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions udp/udp_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (
//TODO: make it support reload as best you can!

type StdConn struct {
sysFd int
isV4 bool
l *logrus.Logger
batch int
sysFd int
closed bool
isV4 bool
l *logrus.Logger
batch int
}

func maybeIPV4(ip net.IP) (net.IP, bool) {
Expand Down Expand Up @@ -142,6 +143,11 @@ func (u *StdConn) ListenOut(r EncReader, lhf LightHouseHandlerFunc, cache *firew
return
}

if u.closed {
u.l.Debug("flag for closing connection is set, exiting read loop")
return
}

//metric.Update(int64(n))
for i := 0; i < n; i++ {
if u.isV4 {
Expand Down Expand Up @@ -315,6 +321,10 @@ func (u *StdConn) getMemInfo(meminfo *[unix.SK_MEMINFO_VARS]uint32) error {

func (u *StdConn) Close() error {
//TODO: this will not interrupt the read loop
if u.closed {
return nil
}
u.closed = true
return syscall.Close(u.sysFd)
}

Expand Down

0 comments on commit 84d1a26

Please sign in to comment.