diff --git a/src/httpd.js.c b/src/httpd.js.c index 6a8b46f3..05fdde14 100644 --- a/src/httpd.js.c +++ b/src/httpd.js.c @@ -561,50 +561,6 @@ static void _httpd_endpoint_trace(tf_http_request_t* request) tf_free(json); } -static void _httpd_endpoint_ebt(tf_http_request_t* request) -{ - if (_httpd_redirect(request)) - { - return; - } - - tf_task_t* task = request->user_data; - tf_ssb_t* ssb = tf_task_get_ssb(task); - JSContext* context = tf_ssb_get_context(ssb); - - JSValue object = JS_NewObject(context); - - tf_ssb_connection_t* connections[256]; - int connection_count = tf_ssb_get_connections(ssb, connections, tf_countof(connections)); - for (int i = 0; i < connection_count; i++) - { - char id[k_id_base64_len]; - tf_ssb_connection_get_id(connections[i], id, sizeof(id)); - - char key[256]; - JSValue clock = JS_NewObject(context); - snprintf(key, sizeof(key), "%d:%s", i, id); - - tf_ssb_ebt_t* ebt = tf_ssb_connection_get_ebt(connections[i]); - tf_ssb_ebt_debug_clock(ebt, context, clock); - JS_SetPropertyStr(context, object, key, clock); - } - - JSValue json_value = JS_JSONStringify(context, object, JS_NULL, JS_NewInt32(context, 2)); - const char* json = JS_ToCString(context, json_value); - JS_FreeValue(context, json_value); - - const char* headers[] = { - "Content-Type", - "application/json; charset=utf-8", - "Access-Control-Allow-Origin", - "*", - }; - tf_http_respond(request, 200, headers, tf_countof(headers) / 2, json, json ? strlen(json) : 0); - JS_FreeCString(context, json); - JS_FreeValue(context, object); -} - static void _httpd_endpoint_mem(tf_http_request_t* request) { if (_httpd_redirect(request)) @@ -2418,7 +2374,6 @@ tf_http_t* tf_httpd_create(JSContext* context) tf_http_add_handler(http, "/debug", _httpd_endpoint_debug, NULL, task); tf_http_add_handler(http, "/mem", _httpd_endpoint_mem, NULL, task); tf_http_add_handler(http, "/trace", _httpd_endpoint_trace, NULL, task); - tf_http_add_handler(http, "/ebt", _httpd_endpoint_ebt, NULL, task); tf_http_add_handler(http, "/login/logout", _httpd_endpoint_logout, NULL, task); tf_http_add_handler(http, "/login/auto", _httpd_endpoint_login_auto, NULL, task); diff --git a/src/ssb.ebt.c b/src/ssb.ebt.c index bd9b7b78..9c68fc59 100644 --- a/src/ssb.ebt.c +++ b/src/ssb.ebt.c @@ -384,28 +384,6 @@ void tf_ssb_ebt_set_send_clock_pending(tf_ssb_ebt_t* ebt, int pending) ebt->send_clock_pending = pending; } -void tf_ssb_ebt_debug_clock(tf_ssb_ebt_t* ebt, JSContext* context, JSValue debug) -{ - uv_mutex_lock(&ebt->mutex); - for (int i = 0; i < ebt->entries_count; i++) - { - ebt_entry_t* entry = &ebt->entries[i]; - JSValue clock = JS_NewObject(context); - JSValue out = JS_NewObject(context); - JSValue in = JS_NewObject(context); - JS_SetPropertyStr(context, out, "value", JS_NewInt64(context, entry->out)); - JS_SetPropertyStr(context, out, "replicate", JS_NewBool(context, entry->out_replicate)); - JS_SetPropertyStr(context, out, "receive", JS_NewBool(context, entry->out_receive)); - JS_SetPropertyStr(context, clock, "out", out); - JS_SetPropertyStr(context, in, "value", JS_NewInt64(context, entry->in)); - JS_SetPropertyStr(context, in, "replicate", JS_NewBool(context, entry->in_replicate)); - JS_SetPropertyStr(context, in, "receive", JS_NewBool(context, entry->in_receive)); - JS_SetPropertyStr(context, clock, "in", in); - JS_SetPropertyStr(context, debug, entry->id, clock); - } - uv_mutex_unlock(&ebt->mutex); -} - void tf_ssb_ebt_get_progress(tf_ssb_ebt_t* ebt, int* in_pending, int* in_total, int* out_pending, int* out_total) { uv_mutex_lock(&ebt->mutex); diff --git a/src/ssb.ebt.h b/src/ssb.ebt.h index a432dd88..ab1da482 100644 --- a/src/ssb.ebt.h +++ b/src/ssb.ebt.h @@ -106,15 +106,6 @@ int tf_ssb_ebt_get_send_clock_pending(tf_ssb_ebt_t* ebt); */ void tf_ssb_ebt_set_send_clock_pending(tf_ssb_ebt_t* ebt, int pending); -/** -** Get a JSON representation of the clock state for -** debugging. -** @param ebt The EBT instance. -** @param context The JS context. -** @param debug A JS object populated with the information. -*/ -void tf_ssb_ebt_debug_clock(tf_ssb_ebt_t* ebt, JSContext* context, JSValue debug); - /** ** Get a representation of sync progress. ** @param ebt The EBT instance.