forked from vitalif/vitastor
Fix a small memory leak in etcd_state_client
parent
314b20437b
commit
bc742ccf8c
|
@ -7,6 +7,16 @@
|
||||||
#include "http_client.h"
|
#include "http_client.h"
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
|
|
||||||
|
etcd_state_client_t::~etcd_state_client_t()
|
||||||
|
{
|
||||||
|
etcd_watches_initialised = -1;
|
||||||
|
if (etcd_watch_ws)
|
||||||
|
{
|
||||||
|
etcd_watch_ws->close();
|
||||||
|
etcd_watch_ws = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
json_kv_t etcd_state_client_t::parse_etcd_kv(const json11::Json & kv_json)
|
json_kv_t etcd_state_client_t::parse_etcd_kv(const json11::Json & kv_json)
|
||||||
{
|
{
|
||||||
json_kv_t kv;
|
json_kv_t kv;
|
||||||
|
@ -160,7 +170,7 @@ void etcd_state_client_t::start_etcd_watcher()
|
||||||
start_etcd_watcher();
|
start_etcd_watcher();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else if (etcd_watches_initialised > 0)
|
||||||
{
|
{
|
||||||
// Connection was live, retry immediately
|
// Connection was live, retry immediately
|
||||||
start_etcd_watcher();
|
start_etcd_watcher();
|
||||||
|
|
|
@ -81,4 +81,5 @@ struct etcd_state_client_t
|
||||||
void load_pgs();
|
void load_pgs();
|
||||||
void parse_state(const std::string & key, const json11::Json & value);
|
void parse_state(const std::string & key, const json11::Json & value);
|
||||||
void parse_config(json11::Json & config);
|
void parse_config(json11::Json & config);
|
||||||
|
~etcd_state_client_t();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue