Skip to content
  • Thomas Haller's avatar
    pacrunner: refactor pacrunner to use GDBusConnection · 83476a3f
    Thomas Haller authored
    - use GDBusConnection instead of GDBusProxy.
    
    - rename "call-id" to "conf-id". It's really not a "call" but
      configuration that gets added and NMPacrunnerManager ensures that
      the configuration is send to pacrunner.
    
    - let "conf-id" keep a reference to NMPacrunnerManager. For one,
      when we remove configurations we need to call DestroyProxyConfiguration
      to remove it again. We cannot just abort the requests but must linger
      around until our configuration is properly cleaned up. Hence, we
      anyway cannot destroy the NMPacrunnerManager earlier.
      With respect to fixing shutdown not to leak anything, this merely
      means that we must wait (and iterate the main loop) as long as
      NMPacrunnerManager singleton still exits (that is anyway the plan
      how to fix shutdown).
      With these considerations it's also clear that our D-Bus calls must
      have a stricter timeout: NM_SHUTDOWN_TIMEOUT_MS.
      This is also nice because nm_pacrunner_manager_remove() no longer
      needs a manager parameter, it can just rely on having a reference
      to the manager.
    
    - for logging the configuration IDs, don't log pointer values.
      Logging pointer values should be avoided as it defeats ASLR.
      Instead, give them a "log_id" number.
    
    - pacrunner is a D-Bus activatable service. D-Bus activatable services
      needs special care. We don't want to start it over and over again.
      Instead, we only try to "StartServiceByName" if
    
        - we have any configuration to add
    
        - if pacrunner is currently confirmed not to be running (by watching
          name owner changes)
    
        - we didn't try to start it already. That means, only start it
          at the beginning and afterwards set a flag to block it. When
          we see pacrunner appear on D-Bus we always clear that flag,
          that means if pacrunner drops of, we will try to restart it
          (once).
    83476a3f