mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Break out multicast into a separate package
This commit is contained in:
		
							parent
							
								
									03bc7bbcd6
								
							
						
					
					
						commit
						7ea4e9575e
					
				
					 10 changed files with 103 additions and 71 deletions
				
			
		
							
								
								
									
										26
									
								
								src/multicast/multicast_windows.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/multicast/multicast_windows.go
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
// +build windows
 | 
			
		||||
 | 
			
		||||
package multicast
 | 
			
		||||
 | 
			
		||||
import "syscall"
 | 
			
		||||
import "golang.org/x/sys/windows"
 | 
			
		||||
 | 
			
		||||
func (m *Multicast) multicastStarted() {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *Multicast) multicastReuse(network string, address string, c syscall.RawConn) error {
 | 
			
		||||
	var control error
 | 
			
		||||
	var reuseaddr error
 | 
			
		||||
 | 
			
		||||
	control = c.Control(func(fd uintptr) {
 | 
			
		||||
		reuseaddr = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1)
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	switch {
 | 
			
		||||
	case reuseaddr != nil:
 | 
			
		||||
		return reuseaddr
 | 
			
		||||
	default:
 | 
			
		||||
		return control
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue