[rabbitmq-discuss] amqp_login -> AMQP_RESPONSE_NONE (RabbitMQ C Client)
Tony Garnock-Jones
tonyg at lshift.net
Thu Feb 18 03:34:57 GMT 2010
Hi Frank,
Thanks for posting the code. I think I see the problem.
Frank Gönninger wrote:
> amqp_login( psContext->psPIBAMQPConnection->psConnection,
> psContext->psPIBAMQPConnection->pcAMQPVirtualHost,
> psContext->psPIBAMQPConnection->nAMQPChannelMax,
> psContext->psPIBAMQPConnection->nAMQPFrameMax,
> psContext->psPIBAMQPConnection->nAMQPHeartbeat,
> psContext->psPIBAMQPConnection->nAMQPSaslMethod,
> psContext->psPIBAMQPConnection->pcAMQPUser,
> psContext->psPIBAMQPConnection->pcAMQPPassword );
>
> nRC = nCheckAMQPRpcReply( psContext, amqp_get_rpc_reply(),
> __FILE__, __LINE__, __func__ );
The problem is that amqp_get_rpc_reply() is only intended for use with
API operations that don't themselves return an amqp_rpc_reply_t. The
amqp_login function does return an amqp_rpc_reply_t value, so you should
be checking that instead of the result of amqp_get_rpc_reply(). It's
confusing and undocumented, I know; I'm working on making it less
confusing and improving the documentation too.
[Aside: everything after the SASL method argument to amqp_login is
varargs, so if you're hard-coding the username and password in those
positions, it makes sense to remove your nAMQPSaslMethod field and
instead hardcode AMQP_SASL_METHOD_PLAIN.]
I've also changed the code just now to no longer ignore the result of
amqp_login_inner. Thanks for the bug reports!
Regards,
Tony
More information about the rabbitmq-discuss
mailing list