Reconnect at flush
Merge pull request #16 from anekos/fix/reconnector

Fix to reconnect when the server restarts(Contributed by @anekos via oza).