veyron/runtimes/google/ipc/stream/vif: Fix race in VIF closure.

Thanks to caprita@ for most of the debugging.
This should fix flakiness in the test:
veyron/lib/signals.TestCleanRemoteShutdown
(and possibly others)

The race prior to this change:
- vif.readLoop reads a valid message for a flow and enqueues it for the
  vcDispatchLoop
- The remote end closes the TCP connection
- vif.readLoop detects the TCP connection is closed and thus
  calls vif.Close
- vif.Close calls vc.Close on all VCs
- vcDispatchLoop calls vc.DispatchPayload on the closed VC.
  This fails, and thus the valid message is lost.

With this fix, vif.readLoop ensures that all vcDispatchLoops
have drained their messages before closing the VC.

Change-Id: Iac98f51aeaadc4f2ea7a69d29499a59c69528318
1 file changed
tree: c41da1ceafeee66d0e19c6f149daaa352d3f0b18
  1. examples/
  2. lib/
  3. runtimes/
  4. security/
  5. services/
  6. tools/