Skip to content

Commit

Permalink
generate alert instead of panic when encountering incorrect listen on…
Browse files Browse the repository at this point in the history
… port 0 on IPv4 or v6 address (#3172)
  • Loading branch information
xiaokangwang authored Oct 1, 2024
1 parent b921dca commit 5ca0f36
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transport/internet/transportcommon/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func ListenWithSecuritySettings(ctx context.Context, address net.Address, port n
transportListener := transportEnvironment.Listener()

if port == net.Port(0) { // unix
if !address.Family().IsDomain() {
return nil, newError("invalid address for unix domain socket: ", address)
}
listener, err := transportListener.Listen(ctx, &net.UnixAddr{
Name: address.Domain(),
Net: "unix",
Expand Down

0 comments on commit 5ca0f36

Please sign in to comment.