mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Act multicast updates for safety
This commit is contained in:
		
							parent
							
								
									a072e063d8
								
							
						
					
					
						commit
						337626a32c
					
				
					 3 changed files with 11 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -60,6 +60,13 @@ func (a *AdminSocket) Init(c *yggdrasil.Core, state *config.NodeState, log *log.
 | 
			
		|||
	a.handlers = make(map[string]handler)
 | 
			
		||||
	current := state.GetCurrent()
 | 
			
		||||
	a.listenaddr = current.AdminListen
 | 
			
		||||
	a.AddHandler("list", []string{}, func(in Info) (Info, error) {
 | 
			
		||||
		handlers := make(map[string]interface{})
 | 
			
		||||
		for handlername, handler := range a.handlers {
 | 
			
		||||
			handlers[handlername] = Info{"fields": handler.args}
 | 
			
		||||
		}
 | 
			
		||||
		return Info{"list": handlers}, nil
 | 
			
		||||
	})
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -75,13 +82,6 @@ func (a *AdminSocket) UpdateConfig(config *config.NodeConfig) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func (a *AdminSocket) SetupAdminHandlers(na *AdminSocket) {
 | 
			
		||||
	a.AddHandler("list", []string{}, func(in Info) (Info, error) {
 | 
			
		||||
		handlers := make(map[string]interface{})
 | 
			
		||||
		for handlername, handler := range a.handlers {
 | 
			
		||||
			handlers[handlername] = Info{"fields": handler.args}
 | 
			
		||||
		}
 | 
			
		||||
		return Info{"list": handlers}, nil
 | 
			
		||||
	})
 | 
			
		||||
	a.AddHandler("getSelf", []string{}, func(in Info) (Info, error) {
 | 
			
		||||
		ip := a.core.Address().String()
 | 
			
		||||
		subnet := a.core.Subnet()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,6 +109,10 @@ func (m *Multicast) Stop() error {
 | 
			
		|||
// and then signals the various module goroutines to reconfigure themselves if
 | 
			
		||||
// needed.
 | 
			
		||||
func (m *Multicast) UpdateConfig(config *config.NodeConfig) {
 | 
			
		||||
	m.Act(m, func() { m._updateConfig(config) })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *Multicast) _updateConfig(config *config.NodeConfig) {
 | 
			
		||||
	m.log.Debugln("Reloading multicast configuration...")
 | 
			
		||||
	if m.IsStarted() {
 | 
			
		||||
		if len(config.MulticastInterfaces) == 0 || config.LinkLocalTCPPort != m.listenPort {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue