From c7b3f71f1454dba32c72086e3411fd459a015b39 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Wed, 20 Aug 2014 13:40:29 +0200 Subject: [PATCH] the connection.close function was only waiting for synchronous calls to complete, async calls that were waiting (after a synchronous) were still discarded, this has been fixed --- include/channel.h | 6 ++---- include/channelimpl.h | 33 ++++++++++++++++++++++++++++++++- src/channelimpl.cpp | 24 +++++++++++++++--------- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/include/channel.h b/include/channel.h index 94a7b99c..39a22290 100644 --- a/include/channel.h +++ b/include/channel.h @@ -52,8 +52,7 @@ class Channel */ void onReady(const SuccessCallback &callback) { - // store callback in implementation - _implementation->_readyCallback = callback; + _implementation->onReady(callback); } /** @@ -66,8 +65,7 @@ class Channel */ void onError(const ErrorCallback &callback) { - // store callback in implementation - _implementation->_errorCallback = callback; + _implementation->onError(callback); } /** diff --git a/include/channelimpl.h b/include/channelimpl.h index f03930d8..b9c51db7 100644 --- a/include/channelimpl.h +++ b/include/channelimpl.h @@ -144,9 +144,40 @@ class ChannelImpl : public Watchable, public std::enable_shared_from_thissend(frame); + if (!_connection->send(frame)) return false; + + // frame was sent, if this was a synchronous frame, we now have to wait + _synchronous = frame.synchronous(); + + // done + return true; } /**