mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Version 0.4.6
This commit is contained in:
parent
b8a2d9f125
commit
4c66a13b93
17 changed files with 174 additions and 115 deletions
|
@ -15,15 +15,19 @@ func (m *Multicast) _multicastStarted() {
|
|||
|
||||
func (m *Multicast) multicastReuse(network string, address string, c syscall.RawConn) error {
|
||||
var control error
|
||||
var reuseport error
|
||||
var reuseaddr error
|
||||
|
||||
control = c.Control(func(fd uintptr) {
|
||||
reuseport = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
|
||||
// Previously we used SO_REUSEPORT here, but that meant that machines running
|
||||
// Yggdrasil nodes as different users would inevitably fail with EADDRINUSE.
|
||||
// The behaviour for multicast is similar with both, so we'll use SO_REUSEADDR
|
||||
// instead.
|
||||
reuseaddr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
|
||||
})
|
||||
|
||||
switch {
|
||||
case reuseport != nil:
|
||||
return reuseport
|
||||
case reuseaddr != nil:
|
||||
return reuseaddr
|
||||
default:
|
||||
return control
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue