akalend/amqpcpp — pull request #10 by jerrybao (2012-05-10 22:05:02+00:00)
Title: Clean up connection if login fails.

In new AMPQ, if connection is fine but logging in fails because whatever reason (wrong password, etc.), we are not cleaning up the connection and closing the fd, before throwing an exception to the client. This is causing connections lingering in "CLOSE_WAIT" state.

The fix is to call amqp_destroy_connection(cnn) which also attempts to close the fd if it is there.