ssb: Attempt to show EBT replication progress in the connections tab, mainly to help track down bugs, which there are.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
16
src/ssb.js.c
16
src/ssb.js.c
@ -3,6 +3,7 @@
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "ssb.db.h"
|
||||
#include "ssb.ebt.h"
|
||||
#include "ssb.h"
|
||||
#include "util.js.h"
|
||||
|
||||
@ -942,6 +943,21 @@ static JSValue _tf_ssb_connections(JSContext* context, JSValueConst this_val, in
|
||||
{
|
||||
JS_SetPropertyStr(context, object, "destroy_reason", JS_NewString(context, destroy_reason));
|
||||
}
|
||||
int in = 0;
|
||||
int out = 0;
|
||||
int max_in = 0;
|
||||
int max_out = 0;
|
||||
tf_ssb_ebt_get_progress(tf_ssb_connection_get_ebt(connection), &in, &max_in, &out, &max_out);
|
||||
JSValue progress = JS_NewObject(context);
|
||||
JSValue in_progress = JS_NewObject(context);
|
||||
JS_SetPropertyStr(context, in_progress, "current", JS_NewInt32(context, in));
|
||||
JS_SetPropertyStr(context, in_progress, "total", JS_NewInt32(context, max_in));
|
||||
JS_SetPropertyStr(context, progress, "in", in_progress);
|
||||
JSValue out_progress = JS_NewObject(context);
|
||||
JS_SetPropertyStr(context, out_progress, "current", JS_NewInt32(context, out));
|
||||
JS_SetPropertyStr(context, out_progress, "total", JS_NewInt32(context, max_out));
|
||||
JS_SetPropertyStr(context, progress, "out", out_progress);
|
||||
JS_SetPropertyStr(context, object, "progress", progress);
|
||||
JS_SetPropertyUint32(context, result, i, object);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user