Commit 04d6fc89 authored by Paweł Wegner's avatar Paweł Wegner

Auth: don't call callback twice.

parent c37fc46e
......@@ -226,6 +226,8 @@ class GenericCallback {
GenericCallback(typename IGenericCallback<Arguments...>::Pointer functor)
: functor_(functor) {}
GenericCallback(std::nullptr_t) {}
operator bool() const { return static_cast<bool>(functor_); }
void operator()(Arguments... d) const { functor_->done(d...); }
......
......@@ -47,7 +47,7 @@ IHttpServer::IResponse::Pointer Auth::HttpServerCallback::handle(
const char* error = request.get(data_.error_parameter_name_);
if (accepted) {
std::unique_lock<std::mutex> lock(lock_);
auto callback = std::move(data_.callback_);
auto callback = util::exchange(data_.callback_, nullptr);
lock.unlock();
if (callback) {
if (std::string(accepted) == "true" && code) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment