浏览代码

* fixed bug: check connection status before closing channel

master
bergmann 7 年前
父节点
当前提交
eeafb28e4d
共有 3 个文件被更改,包括 6 次插入1 次删除
  1. +2
    -0
      include/cppamqp/connection.h
  2. +3
    -0
      include/cppamqp/connection.inl
  3. +1
    -1
      src/cppamqp/channel.cpp

+ 2
- 0
include/cppamqp/connection.h 查看文件

@@ -34,6 +34,8 @@ namespace cppamqp
std::unique_ptr<internal> _internal;

public:
inline operator bool() const;

inline amqp_connection_state_t& handle ();
inline const amqp_connection_state_t& handle () const;



+ 3
- 0
include/cppamqp/connection.inl 查看文件

@@ -35,6 +35,9 @@ namespace cppamqp
return value;
}

connection::operator bool() const
{ return static_cast<bool>(_internal); }

amqp_connection_state_t& connection::handle()
{
if (!_internal)


+ 1
- 1
src/cppamqp/channel.cpp 查看文件

@@ -20,7 +20,7 @@ channel::internal::internal(const cppamqp::connection& p_connection, channel_num

channel::internal::~internal()
{
if (handle <= 0)
if (handle <= 0 || !static_cast<bool>(connection))
return;
__impl::check_and_raise(
amqp_channel_close(connection.handle(), handle, AMQP_REPLY_SUCCESS),


正在加载...
取消
保存