A first draft fix would say "if we have sent 0 bytes after X tries, fail". Looking at the man page, send() should block until the bytes requested are sent, or give other sorts of errors about the message size being too big, etc.
I would probably do something like:
num_zero_sends = 0 max_zero_sends = 3 # config entry?
while sent_bytes < ...: if sent == 0: num_zero_sends += 1 if num_zero_sends > max_zero_sends: raise errors.ConnectionReset(...) else: num_zero_sends = 0
That allows us to have a transient '0' bytes sent at any point, but in the end we must get forward progress or we will fail properly.
A first draft fix would say "if we have sent 0 bytes after X tries, fail". Looking at the man page, send() should block until the bytes requested are sent, or give other sorts of errors about the message size being too big, etc.
I would probably do something like:
num_zero_sends = 0
max_zero_sends = 3 # config entry?
while sent_bytes < ...: ConnectionReset (...)
if sent == 0:
num_zero_sends += 1
if num_zero_sends > max_zero_sends:
raise errors.
else:
num_zero_sends = 0
That allows us to have a transient '0' bytes sent at any point, but in the end
we must get forward progress or we will fail properly.