From 0da335c03c159394de76a74252e7b5795e61272d Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 15 Nov 2018 18:36:26 -0800 Subject: [PATCH] modules/client/sync: Minor hackstops for now. --- modules/client/sync.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/client/sync.cc b/modules/client/sync.cc index 994b828ee..30a89e246 100644 --- a/modules/client/sync.cc +++ b/modules/client/sync.cc @@ -158,7 +158,10 @@ ircd::m::sync::longpoll::handle_notify(const m::event &event, return; if(!polling) + { + queue.clear(); return; + } queue.emplace_back(eval); dock.notify_all(); @@ -177,14 +180,20 @@ try while(1) { - dock.wait_until(args.timesout); + if(!dock.wait_until(args.timesout)) + throw m::error + { + http::REQUEST_TIMEOUT, "M_TIMEOUT", "Timed out" + }; + if(queue.empty()) continue; const auto &a(queue.front()); const unwind pop{[] { - queue.pop_front(); + if(polling <= 1) + queue.pop_front(); }}; if(handle(client, args, a))