conn: close ipv4 socket when ipv6 socket fails

This commit is contained in:
Jason A. Donenfeld 2019-02-05 21:55:33 +09:00
parent 3e8f2e3fa5
commit f7f63765d1

View file

@ -111,7 +111,6 @@ func CreateBind(uport uint16, device *Device) (Bind, uint16, error) {
bind.ipv6, port, err = listenNet("udp6", port)
if err != nil && extractErrno(err) != syscall.EAFNOSUPPORT {
return nil, 0, err
bind.ipv4.Close()
bind.ipv4 = nil
return nil, 0, err