socket: fix connection failed bug