• Thomas Haller's avatar
    ppp-manager: rework stopping NMPPPManager by merging async/sync methods · 43f67b42
    Thomas Haller authored
    Previously, there were two functions nm_ppp_manager_stop_sync() and
    However, stop-sync() would still kill the process asynchronously (with a
    2 seconds timeout before sending SIGKILL).
    On the other hand, stop-async() did pretty much the same thing as
    sync-code, except also using the GAsyncResult.
    Merge the two functions. Stopping the instance for the most part can be
    done entirely synchrnous. The only thing that is asynchronous, is
    to wait for the process to terminate. For that, add a new callback
    argument to nm_ppp_manager_stop(). This replaces the GAsyncResult
    Also, always ensure that NetworkManager runs the mainloop at least as
    long until the process really terminated. Currently we don't get that
    right, and during shutdown we just stop iterating the mainloop. However,
    fix this from point of view of NMPPPManager and register a wait-object,
    that later will correctly delay shutdown.
    Also, NMDeviceWwan cared to wait (asynchronously) until pppd really
    terminated. Keep that functionality. nm_ppp_manager_stop() returns
    a handle that can be used to cancel the asynchrounous request and invoke
    the callback right away. However note, that even when cancelling the
    request, the wait-object that prevents shutdown of NetworkManager is
    kept around, so that we can be sure to properly clean up.
nm-ppp-manager.h 1.69 KB