Re: c client "0" state?

2010-09-27 Thread Patrick Hunt
Seems like a bug to me. Please enter a JIRA (if you haven't already).

Thanks,

Patrick

On Fri, Sep 17, 2010 at 9:10 AM, Michael Xu  wrote:

> Hi everyone
>
> in the c client api:
>
> Is it normal for zoo_state() to return zero (not one of the valid state
> consts) when it is handling socket errors?
>
>
> In the C Code, handle_error(), which handles socket errors,  sets the
> zh->state to zero,
> ==
>if (!is_unrecoverable(zh))
>zh->state = 0;
> ==
>
> If the handle is recoverable, why is the state set to zero, which is not
> even a valid state const?
>
> Here's a use case where the state should be connecting, but instead is
> zero:
>
> 1) c client connects to a zkserver
> 2) shutdown zkserver
> 3) zoo_state() returns zero on a valid zookeeper handle.
>
>
> We are using zoo_state() to get the state of the connection, and this is
> a surprising returned value from this function.
>
>
> Thanks,
>
> michael
>
>


c client "0" state?

2010-09-17 Thread Michael Xu
Hi everyone

in the c client api:

Is it normal for zoo_state() to return zero (not one of the valid state
consts) when it is handling socket errors?


In the C Code, handle_error(), which handles socket errors,  sets the
zh->state to zero, 
==
if (!is_unrecoverable(zh))  
zh->state = 0;
==

If the handle is recoverable, why is the state set to zero, which is not
even a valid state const? 

Here's a use case where the state should be connecting, but instead is
zero:

1) c client connects to a zkserver
2) shutdown zkserver
3) zoo_state() returns zero on a valid zookeeper handle. 


We are using zoo_state() to get the state of the connection, and this is
a surprising returned value from this function.


Thanks,

michael