rabbitmq-c icon indicating copy to clipboard operation
rabbitmq-c copied to clipboard

Reconsider naming of *_noblock operations

Open sigiesec opened this issue 8 years ago • 3 comments

The operations amqp_simple_wait_frame_noblock and amqp_socket_open_noblock are not really non-blocking operations, since they may block until the timeout is reached.

amqp_simple_wait_frame_noblock can be used in a non-blocking manner, when called with a 0 timeout. Still, I think that amqp_simple_wait_frame_with_timeout would be a more appropriate name.

However, for amqp_socket_open_noblock, the name is even more misleading, as the operation needs to complete within the timeout, otherwise it is cancelled. A non-blocking socket open operation would return more or less immediately, and there would need to be another operation to check if the operation completed (as is the case for a non-blocking connect and subsequent select calls to check for completion of the non-blocking operation). So again, amqp_socket_open_with_timeout would be a more appropriate name.

sigiesec avatar Apr 13 '16 08:04 sigiesec

I agree that the *_noblock are poorly named at best (misleading maybe). I'll consider renaming them, though given they've been in several releases, its painful for users to need to change their code because I've changed the names of things.

alanxz avatar Apr 18 '16 16:04 alanxz

Simple renaming would be breaking, but the current methods could be declared deprecated, and the newly named methods added.

sigiesec avatar Apr 19 '16 07:04 sigiesec

Given most users of the library will have used at least 1 of these functions, I'm hesitant to rename it, given its just churn for library users, even with a deprecation cycle. I'll consider it though.

alanxz avatar Apr 22 '16 05:04 alanxz