less conservative caching of outgoing data. This fixes #184
This commit is contained in:
parent
f5540e9af2
commit
ec327de396
|
|
@ -5,7 +5,7 @@
|
||||||
* that has a private constructor so that it can not be used from outside
|
* that has a private constructor so that it can not be used from outside
|
||||||
* the AMQP library
|
* the AMQP library
|
||||||
*
|
*
|
||||||
* @copyright 2014 - 2017 Copernica BV
|
* @copyright 2014 - 2018 Copernica BV
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -122,7 +122,8 @@ private:
|
||||||
std::queue<std::pair<bool, CopiedBuffer>> _queue;
|
std::queue<std::pair<bool, CopiedBuffer>> _queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are we currently operating in synchronous mode?
|
* Are we currently operating in synchronous mode? Meaning: do we first have
|
||||||
|
* to wait for the answer to previous instructions before we send a new instruction?
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
bool _synchronous = false;
|
bool _synchronous = false;
|
||||||
|
|
@ -567,6 +568,9 @@ public:
|
||||||
|
|
||||||
// if we are still in connected state we are now ready
|
// if we are still in connected state we are now ready
|
||||||
if (_state == state_connected) _state = state_ready;
|
if (_state == state_connected) _state = state_ready;
|
||||||
|
|
||||||
|
// the last (possibly synchronous) operation was received, so we're no longer in synchronous mode
|
||||||
|
if (_synchronous && _queue.empty()) _synchronous = false;
|
||||||
|
|
||||||
// inform handler
|
// inform handler
|
||||||
if (_readyCallback) _readyCallback();
|
if (_readyCallback) _readyCallback();
|
||||||
|
|
@ -586,7 +590,6 @@ public:
|
||||||
{
|
{
|
||||||
// change state
|
// change state
|
||||||
_state = state_closed;
|
_state = state_closed;
|
||||||
_synchronous = false;
|
|
||||||
|
|
||||||
// create a monitor, because the callbacks could destruct the current object
|
// create a monitor, because the callbacks could destruct the current object
|
||||||
Monitor monitor(this);
|
Monitor monitor(this);
|
||||||
|
|
@ -620,6 +623,9 @@ public:
|
||||||
{
|
{
|
||||||
// skip if there is no oldest callback
|
// skip if there is no oldest callback
|
||||||
if (!_oldestCallback) return true;
|
if (!_oldestCallback) return true;
|
||||||
|
|
||||||
|
// the last (possibly synchronous) operation was received, so we're no longer in synchronous mode
|
||||||
|
if (_synchronous && _queue.empty()) _synchronous = false;
|
||||||
|
|
||||||
// we are going to call callbacks that could destruct the channel
|
// we are going to call callbacks that could destruct the channel
|
||||||
Monitor monitor(this);
|
Monitor monitor(this);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Implementation for a channel
|
* Implementation for a channel
|
||||||
*
|
*
|
||||||
* @copyright 2014 - 2017 Copernica BV
|
* @copyright 2014 - 2018 Copernica BV
|
||||||
*/
|
*/
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "basicdeliverframe.h"
|
#include "basicdeliverframe.h"
|
||||||
|
|
@ -693,7 +693,7 @@ bool ChannelImpl::send(const Frame &frame)
|
||||||
// added to the list of deferred objects. it will be notified about
|
// added to the list of deferred objects. it will be notified about
|
||||||
// the error when the close operation succeeds
|
// the error when the close operation succeeds
|
||||||
if (_state == state_closing) return true;
|
if (_state == state_closing) return true;
|
||||||
|
|
||||||
// are we currently in synchronous mode or are there
|
// are we currently in synchronous mode or are there
|
||||||
// other frames waiting for their turn to be sent?
|
// other frames waiting for their turn to be sent?
|
||||||
if (_synchronous || !_queue.empty())
|
if (_synchronous || !_queue.empty())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue