mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-26 23:59:10 +07:00
fix: should correctly set dialer alive property
This commit is contained in:
@ -39,7 +39,7 @@ func newCollection() *collection {
|
||||
return &collection{
|
||||
AliveDialerSetSet: make(AliveDialerSetSet),
|
||||
Latencies10: NewLatenciesN(10),
|
||||
Alive: false,
|
||||
Alive: true,
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,6 +270,7 @@ func (d *Dialer) Check(timeout time.Duration,
|
||||
}
|
||||
latencies10 := collection.Latencies10
|
||||
latencies10.AppendLatency(timeout)
|
||||
collection.Alive = false
|
||||
}
|
||||
// Inform DialerGroups to update state.
|
||||
// We use lock because AliveDialerSetSet is a reference of that in collection.
|
||||
|
@ -5,10 +5,20 @@
|
||||
|
||||
package control
|
||||
|
||||
import "github.com/cilium/ebpf"
|
||||
import (
|
||||
"github.com/cilium/ebpf"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (c *ControlPlaneCore) OutboundAliveChangeCallback(outbound uint8) func(alive bool, l4proto uint8, ipversion uint8) {
|
||||
return func(alive bool, l4proto uint8, ipversion uint8) {
|
||||
c.log.WithFields(logrus.Fields{
|
||||
"alive": alive,
|
||||
"l4proto": l4proto,
|
||||
"ipversion": ipversion,
|
||||
"outbound_id": outbound,
|
||||
}).Tracef("outbound alive state changed")
|
||||
|
||||
value := uint32(0)
|
||||
if alive {
|
||||
value = 1
|
||||
|
@ -206,6 +206,12 @@ getNew:
|
||||
}
|
||||
// If the udp endpoint has been not alive, remove it from pool and get a new one.
|
||||
if !isNew && !ue.Dialer.MustGetAlive(l4proto, ipversion) {
|
||||
c.log.WithFields(logrus.Fields{
|
||||
"src": src.String(),
|
||||
"l4proto": l4proto,
|
||||
"ipversion": ipversion,
|
||||
"dialer": ue.Dialer.Name(),
|
||||
}).Debugln("Old udp endpoint is not alive and removed")
|
||||
_ = DefaultUdpEndpointPool.Remove(src, ue)
|
||||
goto getNew
|
||||
}
|
||||
|
Reference in New Issue
Block a user