Reland "Add --serial-id option to host_forwarder."

This relands r209945.

r242846 slightly changed the CLI <-> device daemon message sequence which made
the following check fail in case the device daemon was started but already
running on the device: device_forwarder_main.cc:10: CHECK_GT(bytes_read, 0).

This was actually caused by an unexposed long standing issue in daemon.cc.
ConnectToUnixDomainSocket() is performing a hand check to make sure that the
CLI is connecting to the forwarder daemon. While doing this hand check, rather
than only reading the expected fixed-size message, the function was reading all
the available bytes in the socket thus consuming the client data.

BUG=242846
R=bulach@chromium.org

Review URL: https://codereview.chromium.org/18635005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210273 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 5c81f4b8ce46306fce09734e64e3df45fc7b39c7
1 file changed
tree: 2680e3e7c404a56a6a01744e44b9aa28a86768f9
  1. base/
  2. build/
  3. dbus/
  4. ipc/
  5. testing/
  6. third_party/