Vague attempt at some more cleanup, and stick pthread_self() in the traces.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4176 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-02-15 02:34:46 +00:00
parent 1f77df7a90
commit 6b5d73ed5c
2 changed files with 15 additions and 6 deletions

View File

@ -685,12 +685,12 @@ void tf_ssb_connection_rpc_send(tf_ssb_connection_t* connection, uint8_t flags,
{
if (!connection)
{
if (cleanup)
{
cleanup(NULL, user_data);
}
return;
}
if (request_number > 0 && callback)
{
tf_ssb_connection_add_request(connection, request_number, callback, cleanup, user_data, NULL);
}
uint8_t* combined = tf_malloc(9 + size);
*combined = flags;
uint32_t u32size = htonl((uint32_t)size);
@ -706,6 +706,14 @@ void tf_ssb_connection_rpc_send(tf_ssb_connection_t* connection, uint8_t flags,
_tf_ssb_connection_box_stream_send(connection, combined, 1 + 2 * sizeof(uint32_t) + size);
tf_free(combined);
connection->ssb->rpc_out++;
if (request_number > 0 && callback)
{
tf_ssb_connection_add_request(connection, request_number, callback, cleanup, user_data, NULL);
}
else if (cleanup)
{
cleanup(connection->ssb, user_data);
}
}
void tf_ssb_connection_rpc_send_json(tf_ssb_connection_t* connection, uint8_t flags, int32_t request_number, JSValue message, tf_ssb_rpc_callback_t* callback, tf_ssb_callback_cleanup_t* cleanup, void* user_data)