diff options
author | David Wragg <dpw@lshift.net> | 2010-05-30 23:31:40 +0100 |
---|---|---|
committer | David Wragg <dpw@lshift.net> | 2010-05-30 23:31:40 +0100 |
commit | 2347dc9977d3bf0c9ed19f7ed3a905eb4e65fa46 (patch) | |
tree | 56b6486c279997736c61a5b3fe6661caadb7d352 /tools | |
parent | 76e825b388c6c3b65ef238a245748f38d3f1c1fc (diff) | |
download | rabbitmq-c-github-ask-2347dc9977d3bf0c9ed19f7ed3a905eb4e65fa46.tar.gz |
Add amqp_end_connection, which closes the socket and destroys the connection
Diffstat (limited to 'tools')
-rw-r--r-- | tools/common.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/common.c b/tools/common.c index 6c0e871..d4771ac 100644 --- a/tools/common.c +++ b/tools/common.c @@ -245,16 +245,15 @@ amqp_connection_state_t make_connection(void) void close_connection(amqp_connection_state_t conn) { - int s = amqp_get_sockfd(conn); - + int res; die_rpc(amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS), "closing channel"); die_rpc(amqp_connection_close(conn, AMQP_REPLY_SUCCESS), "closing connection"); - amqp_destroy_connection(conn); - - if (close(s) < 0) - die_errno(errno, "closing socket"); + + res = amqp_end_connection(conn); + if (res < 0) + die_errno(-res, "closing connection"); } amqp_bytes_t read_all(int fd) |