python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

zero length 'chunk' should not be an error #640

Open laprej opened 3 years ago

laprej commented 3 years ago

I don't believe that a zero length chunk should trigger an exception. Rather it's the proper way to indicate the other end of the TCP connection has shutdown. I'm not sure in the end it really changes much: kazoo may treat this as an exceptional event which is a fair interpretation. But the exception name / text is misleading as well. ConnectionClosed('socket closed') might be more appropriate.

https://github.com/python-zk/kazoo/blob/6337fd6f72b59fb20886f980f2e0d6d41525dc35/kazoo/protocol/connection.py#L259-L260

StephenSorriaux commented 3 years ago

Hello,

Good point. I will check if the change is that straightforward as it seems.