mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-06-18 01:46:07 +00:00
Redial failed connections if possible (#983)
This commit is contained in:
@ -30,6 +30,7 @@ type Multicast struct {
|
||||
_isOpen bool
|
||||
_listeners map[string]*listenerInfo
|
||||
_interfaces map[string]*interfaceInfo
|
||||
_timer *time.Timer
|
||||
config struct {
|
||||
_groupAddr GroupAddress
|
||||
_interfaces map[MulticastInterface]struct{}
|
||||
@ -207,6 +208,15 @@ func (m *Multicast) _getAllowedInterfaces() map[string]*interfaceInfo {
|
||||
return interfaces
|
||||
}
|
||||
|
||||
func (m *Multicast) AnnounceNow() {
|
||||
phony.Block(m, func() {
|
||||
if m._timer != nil && !m._timer.Stop() {
|
||||
<-m._timer.C
|
||||
}
|
||||
m.Act(nil, m._announce)
|
||||
})
|
||||
}
|
||||
|
||||
func (m *Multicast) _announce() {
|
||||
if !m._isOpen {
|
||||
return
|
||||
@ -329,7 +339,7 @@ func (m *Multicast) _announce() {
|
||||
break
|
||||
}
|
||||
}
|
||||
time.AfterFunc(time.Second, func() {
|
||||
m._timer = time.AfterFunc(time.Second, func() {
|
||||
m.Act(nil, m._announce)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user