Quellcode durchsuchen

* fixed bug: check connection status before closing channel

master
bergmann vor 7 Jahren
Ursprung
Commit
eeafb28e4d
3 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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),


Laden…
Abbrechen
Speichern