change architecture and thread model

fix the reconnect fails bugs
improve the stability