test: Messages added callbacks are not a reliable way to count messages. Fix -t=invite sometimes stalling.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m38s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m38s
This commit is contained in:
@@ -1553,12 +1553,6 @@ void tf_ssb_test_invite(const tf_test_options_t* options)
|
||||
tf_ssb_release_db_writer(ssb0, writer);
|
||||
tf_printf("invite: %s\n", invite);
|
||||
|
||||
int count0 = 0;
|
||||
int count1 = 0;
|
||||
|
||||
tf_ssb_add_message_added_callback(ssb0, _message_added, NULL, &count0);
|
||||
tf_ssb_add_message_added_callback(ssb1, _message_added, NULL, &count1);
|
||||
|
||||
tf_ssb_connect_str(ssb1, invite, 0, NULL, NULL);
|
||||
|
||||
tf_printf("Waiting for connection.\n");
|
||||
@@ -1574,11 +1568,19 @@ void tf_ssb_test_invite(const tf_test_options_t* options)
|
||||
tf_printf("waiting for messages\n");
|
||||
tf_ssb_set_main_thread(ssb0, true);
|
||||
tf_ssb_set_main_thread(ssb1, true);
|
||||
while (count0 != 3 || count1 != 3)
|
||||
|
||||
int32_t sequence0 = 0;
|
||||
int32_t sequence1 = 0;
|
||||
while (sequence0 != 1 || sequence1 != 2)
|
||||
{
|
||||
uv_run(&loop, UV_RUN_ONCE);
|
||||
|
||||
tf_printf("count0=%d count1=%d\n", count0, count1);
|
||||
tf_ssb_set_main_thread(ssb0, false);
|
||||
tf_ssb_set_main_thread(ssb1, false);
|
||||
tf_ssb_db_get_latest_message_by_author(ssb0, id0, &sequence0, NULL, 0);
|
||||
tf_ssb_db_get_latest_message_by_author(ssb1, id1, &sequence1, NULL, 0);
|
||||
tf_ssb_set_main_thread(ssb0, true);
|
||||
tf_ssb_set_main_thread(ssb1, true);
|
||||
tf_printf("sequence0=%d sequence1=%d\n", sequence0, sequence1);
|
||||
}
|
||||
tf_ssb_set_main_thread(ssb0, false);
|
||||
tf_ssb_set_main_thread(ssb1, false);
|
||||
|
Reference in New Issue
Block a user