From 87ce85e521008f48a3d177e54c1bc3863c91188a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 6 Aug 2019 19:30:09 -0700 Subject: [PATCH] modules/client/keys/upload: Workaround race condition in Riot. (Fixes #9) --- modules/client/keys/upload.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/client/keys/upload.cc b/modules/client/keys/upload.cc index 612cd88fc..23ddf7b2f 100644 --- a/modules/client/keys/upload.cc +++ b/modules/client/keys/upload.cc @@ -144,14 +144,15 @@ post__keys_upload(client &client, { json::stack::member { - one_time_key_counts, algorithm, json::value - { - 0L //count TODO: XXX - } + one_time_key_counts, algorithm, json::value{count} }; } } + // Prevents an infinite loop due to a race in riot + if(!counts.empty()) + sleep(seconds(2)); + return resource::response { client, json::object(out.completed())