-t rooms cleanup.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4108 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-01-08 00:44:36 +00:00
parent 3506d9dec1
commit 513eb88a53
3 changed files with 23 additions and 3 deletions

View File

@ -785,6 +785,14 @@ bool tf_ssb_verify_and_strip_signature(JSContext* context, JSValue val, char* ou
return false;
}
void tf_ssb_close_all(tf_ssb_t* ssb)
{
for (tf_ssb_connection_t* connection = ssb->connections; connection; connection = connection->next)
{
_tf_ssb_connection_close(connection, "tf_ssb_close_all");
}
}
void tf_ssb_send_close(tf_ssb_t* ssb)
{
for (tf_ssb_connection_t* connection = ssb->connections; connection; connection = connection->next)

View File

@ -97,6 +97,7 @@ void tf_ssb_connect_str(tf_ssb_t* ssb, const char* address);
void tf_ssb_server_open(tf_ssb_t* ssb, int port);
void tf_ssb_server_close(tf_ssb_t* ssb);
void tf_ssb_close_all(tf_ssb_t* ssb);
void tf_ssb_send_close(tf_ssb_t* ssb);
bool tf_ssb_id_str_to_bin(uint8_t* bin, const char* str);

View File

@ -441,15 +441,26 @@ void tf_ssb_test_rooms(const tf_test_options_t* options)
printf("Done.\n");
uv_run(&loop, UV_RUN_NOWAIT);
tf_ssb_connection_close(tun0);
tf_ssb_send_close(ssb0);
tf_ssb_send_close(ssb1);
tf_ssb_send_close(ssb2);
uv_run(&loop, UV_RUN_NOWAIT);
uv_close((uv_handle_t*)&idle0, NULL);
uv_close((uv_handle_t*)&idle1, NULL);
uv_close((uv_handle_t*)&idle2, NULL);
tf_ssb_send_close(ssb0);
tf_ssb_send_close(ssb1);
tf_ssb_send_close(ssb2);
tf_ssb_close_all(ssb0);
tf_ssb_close_all(ssb1);
tf_ssb_close_all(ssb2);
uv_run(&loop, UV_RUN_DEFAULT);
tf_ssb_destroy(ssb0);
tf_ssb_destroy(ssb1);
tf_ssb_destroy(ssb2);