Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate call amqp_channel_close, it is not necessary #70

Open
fxconfig opened this issue Sep 12, 2017 · 0 comments
Open

duplicate call amqp_channel_close, it is not necessary #70

fxconfig opened this issue Sep 12, 2017 · 0 comments

Comments

@fxconfig
Copy link

an AMQP can manager several Exchanges Or QUEUEs.
every of them have their own channel, right?

if I call delete AMQP* directly,
in the Destructor
channels.size() is not zero, but AMQPBase* in the vector is un-reachable.
the delete *i would throw;

So I suggest call AMQP::closeChannel() in its Destructor.

AMQPBase::~AMQPBase() {
this->closeChannel();
}

AMQP::~AMQP() {
if (channels.size()) {
vector<AMQPBase*>::iterator i;
for (i=channels.begin(); i!=channels.end();) {
delete *i;
}
}

amqp_channel_close(cnn, 1, AMQP_REPLY_SUCCESS);
amqp_connection_close(cnn, AMQP_REPLY_SUCCESS);
amqp_destroy_connection(cnn);

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant