Skip to content
  • Guillaume Roguez's avatar
    call: fix multidevice implementation · 6a93bcdc
    Guillaume Roguez authored
    Following patch was not reviewed (bussiness pressure):
    1dccd81b
    
     [multi-device: initial implementation]
    
    This patch repays it partially by fixing Call::addSubCall() and
    Call::merge() (and overloading) methods.
    
    Many weird and hard-to-debug errors are fixed, as example:
    when a device call is in ICE connection step and fails
    due to OpenDHT error, the device call is terminated but not the
    master call and client is not aware of the situation.
    
    It's a complex patch due to the interlacements of some changes.
    Consider it as a new implementation of multi-device inside Call/IM
    components.
    
    This is a lists of changes made:
    
    - add more documentation to indicate the intent.
    - use reference (&) rather than const shared_ptr<>& type
      as it's identical, if we know that we'll not keep a reference
      (like in merge).
    - add Call::getPtr() and SIPCall::getPtr() helper functions to
      simplify code when we need smart pointer on such objects.
      This also permits to make SIPCall::merge() private and
      more safe-to-bad-usage.
      This also removes the RTTI usage due to a dynamic cast and reduce API.
    - fix std::set() to use correct Compare method when type is a smart ptr.
    - use parent (Call&) rather than the "quiet" member, not always used
      as its name indicates and can reduce the code.
    - remove TRYING state set in addSubcall() as this call is already
      in this state.
    - lock callMutex at right places to ensure multi-thread safety.
    - replace "fat-lambda" by member method (lambda is an unnamed function,
      it's hard to debug in gdb, so keep it thin and simple to make sure
      we don't need to debug that).
    - better pending IM handling.
    - use "override" when we override a virtual method.
    - return immediately when instance maybe deleted as we relaxed smrt_ptr.
    - fix the incorrect state of the parent call when subcall is over.
    - do not send handle IM when subcall is being answered (it's the job
      of the parent call).
    - log pollution: replace RING_WARN by RING_DBG when we don't want to warn
    - remove/re-write log output to have consistency, useful and
      non-redundant information.
    - code cleanup, coding rules, logic blocks spacing, etc.
    
    Change-Id: I8da9747db6ca01d6a50dcde2378ecf8499cf6685
    Reviewed-by: default avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
    Reviewed-by: default avatarAline Bonnet <aline.bonnet@savoirfairelinux.com>
    6a93bcdc