Add StreamListenOptions.reuseAddress
and make it the default.
Replaces the current combined behavior controlled by `reusePort`, introduced by #103.
This commit is contained in:
parent
d20b7a77ee
commit
891eed3d62
3 changed files with 18 additions and 9 deletions
|
@ -221,9 +221,11 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
|
|||
() @trusted {
|
||||
int tmp_reuse = 1;
|
||||
// FIXME: error handling!
|
||||
if ((options & StreamListenOptions.reusePort) && setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &tmp_reuse, tmp_reuse.sizeof) != 0) {
|
||||
invalidateSocket();
|
||||
return;
|
||||
if (options & StreamListenOptions.reuseAddress) {
|
||||
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &tmp_reuse, tmp_reuse.sizeof) != 0) {
|
||||
invalidateSocket();
|
||||
return;
|
||||
}
|
||||
}
|
||||
version (Windows) {} else {
|
||||
if ((options & StreamListenOptions.reusePort) && setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &tmp_reuse, tmp_reuse.sizeof) != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue