debug print of backend state, split test-stream into a netconf and restconf part, change restconf yang auth-type from leaf-list to leaf

This commit is contained in:
Olof hagsand 2021-01-27 14:40:34 +01:00
parent a5f32fbedf
commit b41f68b677
13 changed files with 244 additions and 63 deletions

View file

@ -132,9 +132,9 @@ int
backend_client_rm(clicon_handle h,
struct client_entry *ce)
{
struct client_entry *c;
struct client_entry *c0;
struct client_entry **ce_prev;
struct client_entry *c;
struct client_entry *c0;
struct client_entry **ce_prev;
clicon_debug(1, "%s", __FUNCTION__);
/* for all streams: XXX better to do it top-level? */
@ -147,6 +147,7 @@ backend_client_rm(clicon_handle h,
clixon_event_unreg_fd(ce->ce_s, from_client);
close(ce->ce_s);
ce->ce_s = 0;
xmldb_unlock_all(h, ce->ce_id);
}
break;
}
@ -1308,8 +1309,8 @@ from_client_kill_session(clicon_handle h,
}
/* may or may not be in active client list, probably not */
if ((ce = ce_find_byid(backend_client_list(h), id)) != NULL){
xmldb_unlock_all(h, id);
backend_client_rm(h, ce);
xmldb_unlock_all(h, id); /* Removes locks on all databases */
backend_client_rm(h, ce); /* Removes client struct */
}
if (xmldb_islocked(h, db) == id)
xmldb_unlock(h, db);

View file

@ -54,4 +54,6 @@ struct client_entry *backend_client_list(clicon_handle h);
int backend_client_delete(clicon_handle h, struct client_entry *ce);
int backend_client_print(clicon_handle h, FILE *f);
#endif /* _BACKEND_HANDLE_H_ */

View file

@ -188,3 +188,25 @@ backend_client_delete(clicon_handle h,
return 0;
}
/*! Debug print backend clients
* @param[in] h Clicon handle
* @param[in] f UNIX output stream
*/
int
backend_client_print(clicon_handle h,
FILE *f)
{
struct backend_handle *bh = handle(h);
struct client_entry *ce;
for (ce = bh->bh_ce_list; ce; ce = ce->ce_next){
fprintf(f, "Client: %d\n", ce->ce_nr);
fprintf(f, " Session: %d\n", ce->ce_id);
fprintf(f, " Socket: %d\n", ce->ce_s);
fprintf(f, " Msgs in: %d\n", ce->ce_stat_in);
fprintf(f, " Msgs out: %d\n", ce->ce_stat_out);
fprintf(f, " Username: %s\n", ce->ce_username);
}
return 0;
}