event/ServerSocket: do not close all listeners before rethrowing

If binding one address fails, we don't need to close all listeners.
For fatal errors, this will be done automatically and implicitly; and
for non-fatal errors (e.g. binding to the default port failed, but
there is an XDG listener), this closes the good listeners which are
supposed to be used.

Closes https://github.com/MusicPlayerDaemon/MPD/pull/2157
This commit is contained in:
Max Kellermann
2024-12-04 14:21:42 +01:00
parent b6e187efd8
commit 9a8579d956

@ -216,7 +216,6 @@ ServerSocket::Open()
continue; continue;
if (bad != nullptr && i.GetSerial() != bad->GetSerial()) { if (bad != nullptr && i.GetSerial() != bad->GetSerial()) {
Close();
std::rethrow_exception(last_error); std::rethrow_exception(last_error);
} }
@ -257,7 +256,6 @@ ServerSocket::Open()
} }
if (bad != nullptr) { if (bad != nullptr) {
Close();
std::rethrow_exception(last_error); std::rethrow_exception(last_error);
} }
} }