add done channal flag, keep waiting for the go loop func

I  already signed the Go CLA.