Skip to content

Why is the motivation to always set SO_REUSEPORT for servers #3177

Open
@pepone

Description

@pepone

if (ForceShare || RemoteAddress == NULL) {
//
// The port is shared across processors.
//
Option = TRUE;
Result =
setsockopt(
SocketContext->SocketFd,
SOL_SOCKET,
SO_REUSEPORT,
(const void*)&Option,
sizeof(Option));
if (Result == SOCKET_ERROR) {
Status = errno;
QuicTraceEvent(
DatapathErrorStatus,
"[data][%p] ERROR, %u, %s.",
Binding,
Status,
"setsockopt(SO_REUSEPORT) failed");
goto Exit;
}
}

My understanding is that this code always set SO_REUSEPORT for a server, and you will not get the address already in use when two servers use the same address, what is the motivation for this? did you consider making it configurable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalProposed by non-MSFTquestionFurther information is requested

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions