Skip to content

Commit

Permalink
fix, unix socket bind should be only used in passive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cscps committed May 22, 2022
1 parent 8d921f9 commit 73d9480
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/socket/unix_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ func udsSocket(proto, addr string, passive bool, sockOpts ...Option) (fd int, ne
}
}

if err = os.NewSyscallError("bind", unix.Bind(fd, sa)); err != nil {
return
}

if passive {
if err = os.NewSyscallError("bind", unix.Bind(fd, sa)); err != nil {
return
}

// Set backlog size to the maximum.
err = os.NewSyscallError("listen", unix.Listen(fd, listenerBacklogMaxSize))
} else {
Expand Down

0 comments on commit 73d9480

Please # to comment.