Chasing a leak that looks like an EBT clock. Deleted some unneeded code and adding a missing JS free.

This commit is contained in:
Cory McWilliams 2024-03-17 13:44:05 +00:00
parent 5e240de677
commit e5ba51b80a
4 changed files with 1 additions and 31 deletions

BIN
sqlite3 Executable file

Binary file not shown.

View File

@ -287,7 +287,6 @@ typedef struct _tf_ssb_connection_t
tf_ssb_blob_wants_t blob_wants;
bool sent_clock;
int32_t ebt_request_number;
JSValue ebt_send_clock;
JSValue object;
@ -1862,8 +1861,6 @@ static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const ch
if (JS_IsUndefined(connection->object) && !connection->async.data && !connection->tcp.data && !connection->connect.data && connection->ref_count == 0)
{
JS_FreeValue(ssb->context, connection->ebt_send_clock);
connection->ebt_send_clock = JS_UNDEFINED;
tf_free(connection->message_requests);
connection->message_requests = NULL;
connection->message_requests_count = 0;
@ -3594,19 +3591,6 @@ void tf_ssb_connection_set_ebt_request_number(tf_ssb_connection_t* connection, i
connection->ebt_request_number = request_number;
}
JSValue tf_ssb_connection_get_ebt_send_clock(tf_ssb_connection_t* connection)
{
JSContext* context = connection->ssb->context;
return JS_DupValue(context, connection->ebt_send_clock);
}
void tf_ssb_connection_set_ebt_send_clock(tf_ssb_connection_t* connection, JSValue send_clock)
{
JSContext* context = connection->ssb->context;
JS_FreeValue(context, connection->ebt_send_clock);
connection->ebt_send_clock = JS_DupValue(context, send_clock);
}
JSValue tf_ssb_get_disconnection_debug(tf_ssb_t* ssb, JSContext* context)
{
JSValue result = JS_NewObject(context);

View File

@ -819,20 +819,6 @@ int32_t tf_ssb_connection_get_ebt_request_number(tf_ssb_connection_t* connection
*/
void tf_ssb_connection_set_ebt_request_number(tf_ssb_connection_t* connection, int32_t request_number);
/**
** Get the EBT clock for a connection.
** @param connection An SHS connection.
** @return The EBT clock.
*/
JSValue tf_ssb_connection_get_ebt_send_clock(tf_ssb_connection_t* connection);
/**
** Set the EBT clock for a connection.
** @param connection An SHS connection.
** @param send_clock The clock state.
*/
void tf_ssb_connection_set_ebt_send_clock(tf_ssb_connection_t* connection, JSValue send_clock);
/**
** Get whether the EBT clock has been sent for a connection.
** @param connection An SHS connection.

View File

@ -875,6 +875,7 @@ static void _tf_ssb_rpc_ebt_replicate_send_clock_work(tf_ssb_connection_t* conne
tf_ssb_db_get_latest_message_by_author(ssb, work->clock[i].id, &sequence, NULL, 0);
JS_SetPropertyStr(context, full_clock, work->clock[i].id, JS_NewInt64(context, sequence == -1 ? -1 : (sequence << 1)));
}
JS_FreeValue(context, in_clock);
}
JSValue json = JS_JSONStringify(context, full_clock, JS_NULL, JS_NULL);
@ -1025,7 +1026,6 @@ static void _tf_ssb_rpc_ebt_replicate(tf_ssb_connection_t* connection, uint8_t f
else
{
/* EBT clock. */
tf_ssb_connection_set_ebt_send_clock(connection, args);
if (!tf_ssb_connection_get_sent_clock(connection))
{
_tf_ssb_rpc_ebt_replicate_send_clock(connection, request_number, in_clock);