lib/avahi/Client: is if with initializer

This commit is contained in:
Max Kellermann 2024-01-17 18:27:18 +01:00 committed by Max Kellermann
parent a39473a912
commit f85629afa6

View File

@ -43,8 +43,6 @@ Client::Close() noexcept
void
Client::ClientCallback(AvahiClient *c, AvahiClientState state) noexcept
{
int error;
switch (state) {
case AVAHI_CLIENT_S_RUNNING:
for (auto *l : listeners)
@ -53,8 +51,8 @@ Client::ClientCallback(AvahiClient *c, AvahiClientState state) noexcept
break;
case AVAHI_CLIENT_FAILURE:
error = avahi_client_errno(c);
if (error == AVAHI_ERR_DISCONNECTED) {
if (int error = avahi_client_errno(c);
error == AVAHI_ERR_DISCONNECTED) {
Close();
reconnect_timer.Schedule(std::chrono::seconds(10));