diff --git a/src/ssb.c b/src/ssb.c index 6d793405..bc8d44cf 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -1729,6 +1729,7 @@ tf_ssb_t* tf_ssb_create(uv_loop_t* loop, JSContext* context, sqlite3* db) { tf_ssb_t* ssb = tf_malloc(sizeof(tf_ssb_t)); memset(ssb, 0, sizeof(*ssb)); + ssb->verbose = true; if (context) { ssb->context = context; diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index 0b820697..22b629a0 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -36,18 +36,23 @@ static void _tf_ssb_rpc_blobs_get(tf_ssb_connection_t* connection, uint8_t flags for (int i = 0; i < length; i++) { JSValue arg = JS_GetPropertyUint32(context, ids, i); - if (!JS_IsString(arg)) + const char* id = NULL; + if (JS_IsString(arg)) + { + id = JS_ToCString(context, arg); + } + else { JSValue key = JS_GetPropertyStr(context, arg, "key"); - JS_FreeValue(context, arg); - arg = key; + id = JS_ToCString(context, key); + JS_FreeValue(context, key); } - const char* id = JS_ToCString(context, arg); uint8_t* blob = NULL; size_t size = 0; - const int k_send_max = 4096; + const int k_send_max = 8192; if (tf_ssb_db_blob_get(ssb, id, &blob, &size)) { + printf("sending %s (%zd)\n", id, size); for (size_t offset = 0; offset < size; offset += k_send_max) { tf_ssb_connection_rpc_send( @@ -69,7 +74,7 @@ static void _tf_ssb_rpc_blobs_get(tf_ssb_connection_t* connection, uint8_t flags JS_FreeValue(context, ids); tf_ssb_connection_rpc_send( connection, - k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error, + k_ssb_rpc_flag_json | k_ssb_rpc_flag_end_error | k_ssb_rpc_flag_stream, -request_number, (const uint8_t*)(success ? "true" : "false"), strlen(success ? "true" : "false"),