add while retry to reconnect.

Signed-off-by: Daogang Tang <daogangtang@gmail.com>