Subject: Re: socket callbacks

Re: socket callbacks

From: Lijo Antony <lta_at_one.com>
Date: Wed, 27 Jun 2012 18:14:31 +0400

On 06/27/2012 05:35 PM, Daniel Stenberg wrote:
>
> I assume you want that so that you can set some options before connect()
> is done?

>> Suggestion 1, I add a ares_set_socket_created_callback that takes the
>> same parameters as ares_set_socket_callback.
>>
>> Suggestion 2, I rename ares_set_socket_callback to
>> ares_set_socket_connected_callback, I believe that would be more
>> informative name when there are two socket callbacks.
>>
>> Thoughts/opinions on this?
>
> Number 2 is out of the question since that would break the ABI, so I say
> option 1. The difference between these two callbacks (and possibly why)
> should be clearly spelled out in the docs so that users won't get confused.
>

I think a name which makes the purpose explicit would be better.
Something like ares_set_socket_options_callback or
ares_set_sockopt_callback etc.

Distinction with existing "ares_set_socket_callback" would be more clear
as well. Also it would leave room for a future
"ares_set_opensocket_callback". (it's there in my to do list. Couldn't
work on it yet!). Similarity with curl callbacks(opensocket, sockopt)
would be an added advantage.

-lijo
Received on 2012-06-27