Disconnect properly on errors so we can reconnect

Change-Id: Id134be34a24e91a4c0b8a8d11cf4df9593dae687
This commit is contained in:
Daniel Willmann 2018-06-05 17:27:17 +02:00
parent 9b2d511813
commit 1c2ef1ab69
1 changed files with 9 additions and 0 deletions

View File

@ -279,6 +279,15 @@ static int ctrl_client_poll(struct ctrl_client *cc, struct value_node *parent)
llist_for_each_entry(ccgv, &cc->get_vars, list) {
char *value = simple_ctrl_get(cc->sch, ccgv->cfg.name);
/* FIXME: Distinguish between ERROR reply and
* connection issues */
/* Close connection on error */
if (!value) {
simple_ctrl_close(cc->sch);
cc->sch = NULL;
return 0;
}
value_node_add(vn_clnt, vn_clnt, ccgv->cfg.name, value);
free(value); /* no talloc, this is from sscanf() */
}