go-zookeeper
go-zookeeper copied to clipboard
Invalidate watchers when error in loop()
In loop() function, when network error happens, sendLoop() and recvLoop() return for the next connection. loop() also flushes existing requests before reconnecting. Yet watchers should be also notified.
Without the patch watchers won't receive event. And if network error persists, the next connect() would never succeed and watchers will be waiting forever.
Looks like some behaviors of error handling are changed because of my patch. I've updated unit test to reflect the patch. Please let me know if the patch looks good.
Another solution would be set a maximum retry in connect() function and error if can't reach clusters.
+100
Looks like there's a merge conflict here.