Update to last change:
- reset logging flag
- break out of the response writing loop if no more data can be written
to the network.