When we reconnect we are doing an explicit disconnect, this can fail and if we don't handle possible exceptions we won't reconnect (even when it's possible to do so)
A way to reproduce this easily is killing the connection with ss -K (linux only)
A standalone script that I used to reproduce this:
When we reconnect we are doing an explicit disconnect, this can fail and if we don't handle possible exceptions we won't reconnect (even when it's possible to do so)
A way to reproduce this easily is killing the connection with
ss -K
(linux only)A standalone script that I used to reproduce this:
Execution without this patch:
Execution with this patch:
Notice we have successfully reconnected.