rabbitmq-c
rabbitmq-c copied to clipboard
Reconsider naming of *_noblock operations
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.
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.
Simple renaming would be breaking, but the current methods could be declared deprecated, and the newly named methods added.
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.