Add paranoic if()s to prevent accidental double free of etcd_watch_ws
parent
a5cf06acd0
commit
e01c4db702
|
@ -286,8 +286,11 @@ void etcd_state_client_t::start_etcd_watcher()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Revisions before %lu were compacted by etcd, reloading state\n",
|
fprintf(stderr, "Revisions before %lu were compacted by etcd, reloading state\n",
|
||||||
data["result"]["compact_revision"].uint64_value());
|
data["result"]["compact_revision"].uint64_value());
|
||||||
http_close(etcd_watch_ws);
|
if (etcd_watch_ws)
|
||||||
etcd_watch_ws = NULL;
|
{
|
||||||
|
http_close(etcd_watch_ws);
|
||||||
|
etcd_watch_ws = NULL;
|
||||||
|
}
|
||||||
etcd_watch_revision = 0;
|
etcd_watch_revision = 0;
|
||||||
on_reload_hook();
|
on_reload_hook();
|
||||||
}
|
}
|
||||||
|
@ -343,8 +346,11 @@ void etcd_state_client_t::start_etcd_watcher()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Disconnected from etcd\n");
|
fprintf(stderr, "Disconnected from etcd\n");
|
||||||
http_close(etcd_watch_ws);
|
if (etcd_watch_ws)
|
||||||
etcd_watch_ws = NULL;
|
{
|
||||||
|
http_close(etcd_watch_ws);
|
||||||
|
etcd_watch_ws = NULL;
|
||||||
|
}
|
||||||
if (etcd_watches_initialised == 0)
|
if (etcd_watches_initialised == 0)
|
||||||
{
|
{
|
||||||
// Connection not established, retry in <etcd_quick_timeout>
|
// Connection not established, retry in <etcd_quick_timeout>
|
||||||
|
@ -410,8 +416,11 @@ void etcd_state_client_t::start_etcd_watcher()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Websocket ping failed, disconnecting from etcd %s\n", selected_etcd_address.c_str());
|
fprintf(stderr, "Websocket ping failed, disconnecting from etcd %s\n", selected_etcd_address.c_str());
|
||||||
}
|
}
|
||||||
http_close(etcd_watch_ws);
|
if (etcd_watch_ws)
|
||||||
etcd_watch_ws = NULL;
|
{
|
||||||
|
http_close(etcd_watch_ws);
|
||||||
|
etcd_watch_ws = NULL;
|
||||||
|
}
|
||||||
start_etcd_watcher();
|
start_etcd_watcher();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue