On 09/20/2012 12:37 PM, Michael S. Tsirkin wrote:
> On Thu, Sep 20, 2012 at 11:57:37AM +0300, Orit Wasserman wrote:
>> On 09/20/2012 09:03 AM, Michael S. Tsirkin wrote:
>>>> @@ -526,16 +592,19 @@ int inet_connect(const char *str, Error **errp)
>>>> return sock;
>>>> }
>>>>
>>>> -
>>>> -int inet_nonblocking_connect(const char *str, bool *in_progress,
>>>> - Error **errp)
>>>> +int inet_nonblocking_connect(const char *str, ConnectHandler *callback,
>>>> + void *opaque, bool *in_progress, Error
>>>> **errp)
>>>> {
>>>
>>> Would be nice to have some documentation here.
>>> Something like "on immediate success or immediate
>>> failure, in_progress is set to false, in that case
>>> callback is not invoked".
>> of course.
>>>
>>> If you look at it this way, this API is hard to
>>> use right. I'd like to suggest we get rid of
>>> in_progress flag: return -1 on error and
>>> return >=0 and invoke callback on immediate success.
>>>
>> we can even take it further and always invoke the callback
>> (even for immediate error), this way the user of the function
>> can put all the error/success handling in the callback function.
>>
>> Orit
>
> Yes but I don't think this is a good idea:
> there's value in reporting immediate error
> directly to the user when command was invoked,
> this is more user-friendly.
> Not so for immediate success since that is
> only a step in the migration process.
>
>
OK