~mir-team/mir/development-branch

Viewing all changes in revision 1154.

  • Committer: Tarmac
  • Author(s): Alexandros Frantzis
  • Date: 2013-10-22 05:29:00 UTC
  • mfrom: (1148.1.2 fix-1201436-more)
  • Revision ID: tarmac-20131022052900-98h6ps9uf6fk1vyc
client: Allow clients to call API functions after a connection break has been detected

When a client tries to call an API function after a connection break has
been detected in a previous API call, the client blocks in the new call.
This happens because in MirSocketRpcChannel::notify_disconnected() the
pending RPC calls are not forced to complete, since the channel has already
been marked as 'disconnected' by the failure in the previous call.

Note that if the break is first detected while calling an API function,
then that call doesn't block, since this is the first time we call
MirSocketRpcChannel::notify_disconnected() and the pending RPC calls are
forced to complete.

This commit solves this problem by always forcing requests to complete
when a communication failure occurs, even if a disconnection has
already been handled. This is preferred over the alternative of
manually calling the completion callback in a try-catch block when
calling an RPC method because of:

  1. Correctness: In case the communication problem first occurs in that
     call, the callback will be called twice, once by notify_disconnected()
     and once manually.

  2. Consistency: The callback is called from one place regardless of
     whether the communication problem is first detected during that
     call or not. Fixes: https://bugs.launchpad.net/bugs/1201436.

Approved by Robert Carr, Alan Griffiths, PS Jenkins bot.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: