24 lines
327 B
Go
24 lines
327 B
Go
package ripv2
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
func (r *Routes) Timer() {
|
|
t := time.NewTimer(time.Minute * 1)
|
|
go func() {
|
|
for {
|
|
<-t.C
|
|
r.Lock()
|
|
for _, route := range r.Routes {
|
|
if time.Since(route.TTL) >= time.Minute*2 {
|
|
route.FIB = DELETE
|
|
continue
|
|
}
|
|
}
|
|
r.Unlock()
|
|
t.Reset(time.Minute * 1)
|
|
}
|
|
}()
|
|
}
|