MainLoop: improve error handling

Improve error handling, when reading from the log socket:
- On transient errors: sleep, to allow the transient condition
  to pass (and to avoid a tight CPU loop, if the condition is
  not so transient).
- On all other errors: abort the daemon. In the case of a
  non-transient error, we have two choices: continue running,
  or abort (and hope the new process comes up in a good state).
  We to abort, for two reasons:
  - we assume that newer logs are more important than older ones
  - even if we kept running, we might not be able to dump the logs
    that we'd captured so far, short of a core dump. (The request
    to dump logs would, itself, need to be read from the log
    socket.)

Bug: 32481888
Test: ./runtests.sh (on angler)
Change-Id: I68619d192f7682436c9f78b062d1b6070cdabcdf
3 files changed