X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=blobdiff_plain;f=tr%2Ftr_tid_mons.c;h=0a18d2dbe30bffe1d7fabcfbf8e116cf7d3da008;hp=38fbbddb723de6dffcdfee6ecdb57064298ee388;hb=1a106110e5e7f214ea60e7787d02c5565e7193f0;hpb=283699f7ec7db8a8ebe322ccb2568910b5c8701c diff --git a/tr/tr_tid_mons.c b/tr/tr_tid_mons.c index 38fbbdd..0a18d2d 100644 --- a/tr/tr_tid_mons.c +++ b/tr/tr_tid_mons.c @@ -40,14 +40,39 @@ #include #include +/** + * Get the count of completed TID requests + */ static MON_RC handle_show_req_count(void *cookie, json_t **response_ptr) { TIDS_INSTANCE *tids = talloc_get_type_abort(cookie, TIDS_INSTANCE); *response_ptr = json_integer(tids->req_count); - return (*response_ptr) ? MON_NOMEM : MON_SUCCESS; + return (*response_ptr == NULL) ? MON_NOMEM : MON_SUCCESS; +} + +static MON_RC handle_show_req_err_count(void *cookie, json_t **response_ptr) +{ + TIDS_INSTANCE *tids = talloc_get_type_abort(cookie, TIDS_INSTANCE); + *response_ptr = json_integer(tids->error_count); + return (*response_ptr == NULL) ? MON_NOMEM : MON_SUCCESS; +} + +static MON_RC handle_show_req_pending(void *cookie, json_t **response_ptr) +{ + TIDS_INSTANCE *tids = talloc_get_type_abort(cookie, TIDS_INSTANCE); + *response_ptr = json_integer(tids->pids->len); + return (*response_ptr == NULL) ? MON_NOMEM : MON_SUCCESS; } void tr_tid_register_mons_handlers(TIDS_INSTANCE *tids, MONS_INSTANCE *mons) { - mons_register_handler(mons, MON_CMD_SHOW, OPT_TYPE_SHOW_TID_REQ_COUNT, handle_show_req_count, tids); + mons_register_handler(mons, + MON_CMD_SHOW, OPT_TYPE_SHOW_TID_REQ_COUNT, + handle_show_req_count, tids); + mons_register_handler(mons, + MON_CMD_SHOW, OPT_TYPE_SHOW_TID_REQ_ERR_COUNT, + handle_show_req_err_count, tids); + mons_register_handler(mons, + MON_CMD_SHOW, OPT_TYPE_SHOW_TID_REQ_PENDING, + handle_show_req_pending, tids); }