Refactor Server::supportsDualStack(). #2801

Merged
merged 1 commit into from Feb 2, 2017

Projects

None yet

3 participants

@mkrautz
Member
mkrautz commented Feb 1, 2017

The current implementation tries too hard to avoid duplication
of very few lines of code.

Instead, use two separate code paths, one for Windows, one for
Unix-like sytems.

This makes it more readable, and allows us to handle system-specific
quirks much easier. For example, SOCKET is unsigned on Windows, and
comparing it to -1 technically works (at least for two's complement
machines), but causes a compiler warning for a signed vs. unsigned
comparison.

@mkrautz mkrautz Refactor Server::supportsDualStack().
The current implementation tries too hard to avoid duplication
of very few lines of code.

Instead, use two separate code paths, one for Windows, one for
Unix-like sytems.

This makes it more readable, and allows us to handle system-specific
quirks much easier. For example, SOCKET is unsigned on Windows, and
comparing it to -1 technically works (at least for two's complement
machines), but causes a compiler warning for a signed vs. unsigned
comparison.
4d6a813
@mkrautz mkrautz requested review from hacst, Kissaki, and davidebeatrici Feb 1, 2017
@mkrautz
Member
mkrautz commented Feb 1, 2017

Counter-proposal to #2795.

@davidebeatrici

LGTM

@Kissaki
Kissaki approved these changes Feb 2, 2017 View changes
@Kissaki Kissaki merged commit eca32a0 into mumble-voip:master Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment