Fix issue 778:  OperationalError: (OperationalError) server closed the connection unexpectedly

You probably want to call f() once more after reconnecting?