Track request counts?
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3927 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
a154b1c2f6
commit
aee99af953
@ -151,6 +151,7 @@ typedef struct _tf_ssb_t {
|
||||
|
||||
tf_ssb_connection_t* connections;
|
||||
int connections_count;
|
||||
int request_count;
|
||||
|
||||
tf_ssb_connections_t* connections_tracker;
|
||||
|
||||
@ -439,6 +440,7 @@ void tf_ssb_connection_add_request(tf_ssb_connection_t* connection, int32_t requ
|
||||
.user_data = user_data,
|
||||
};
|
||||
connection->requests = request;
|
||||
connection->ssb->request_count++;
|
||||
}
|
||||
|
||||
static void _tf_ssb_connection_remove_request(tf_ssb_connection_t* connection, int32_t request_number)
|
||||
@ -454,6 +456,7 @@ static void _tf_ssb_connection_remove_request(tf_ssb_connection_t* connection, i
|
||||
}
|
||||
*it = found->next;
|
||||
tf_free(found);
|
||||
connection->ssb->request_count--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -465,7 +468,7 @@ void tf_ssb_connection_rpc_send(tf_ssb_connection_t* connection, uint8_t flags,
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (request_number > 0)
|
||||
if (request_number > 0 && callback)
|
||||
{
|
||||
tf_ssb_connection_add_request(connection, request_number, callback, user_data);
|
||||
}
|
||||
@ -1694,6 +1697,7 @@ void tf_ssb_get_stats(tf_ssb_t* ssb, tf_ssb_stats_t* out_stats)
|
||||
.messages_stored = ssb->messages_stored,
|
||||
.rpc_in = ssb->rpc_in,
|
||||
.rpc_out = ssb->rpc_out,
|
||||
.request_count = ssb->request_count,
|
||||
.callbacks =
|
||||
{
|
||||
.rpc = ssb->rpc_count,
|
||||
|
@ -46,6 +46,7 @@ typedef struct _tf_ssb_stats_t
|
||||
int messages_stored;
|
||||
int rpc_in;
|
||||
int rpc_out;
|
||||
int request_count;
|
||||
struct
|
||||
{
|
||||
int rpc;
|
||||
|
@ -738,6 +738,7 @@ static JSValue _tf_task_getStats(JSContext* context, JSValueConst this_val, int
|
||||
JS_SetPropertyStr(context, result, "messages_stored", JS_NewInt32(context, ssb_stats.messages_stored));
|
||||
JS_SetPropertyStr(context, result, "rpc_in", JS_NewInt32(context, ssb_stats.rpc_in));
|
||||
JS_SetPropertyStr(context, result, "rpc_out", JS_NewInt32(context, ssb_stats.rpc_out));
|
||||
JS_SetPropertyStr(context, result, "requests", JS_NewInt32(context, ssb_stats.request_count));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user