mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-13 19:50:36 +01:00
Previously, there were two functions nm_ppp_manager_stop_sync() and nm_ppp_manager_stop_async(). 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 pattern. 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.
42 lines
1.7 KiB
C
42 lines
1.7 KiB
C
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
/* NetworkManager -- Network link manager
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* Copyright (C) 2008 Novell, Inc.
|
|
* Copyright (C) 2008 - 2016 Red Hat, Inc.
|
|
*/
|
|
|
|
#ifndef __NM_PPP_MANAGER_H__
|
|
#define __NM_PPP_MANAGER_H__
|
|
|
|
#define NM_PPP_MANAGER_PARENT_IFACE "parent-iface"
|
|
|
|
#define NM_PPP_MANAGER_SIGNAL_STATE_CHANGED "state-changed"
|
|
#define NM_PPP_MANAGER_SIGNAL_IFINDEX_SET "ifindex-set"
|
|
#define NM_PPP_MANAGER_SIGNAL_IP4_CONFIG "ip4-config"
|
|
#define NM_PPP_MANAGER_SIGNAL_IP6_CONFIG "ip6-config"
|
|
#define NM_PPP_MANAGER_SIGNAL_STATS "stats"
|
|
|
|
typedef struct _NMPPPManager NMPPPManager;
|
|
|
|
typedef struct _NMPPPManagerStopHandle NMPPPManagerStopHandle;
|
|
|
|
typedef void (*NMPPPManagerStopCallback) (NMPPPManager *manager,
|
|
NMPPPManagerStopHandle *handle,
|
|
gboolean was_cancelled,
|
|
gpointer user_data);
|
|
|
|
#endif /* __NM_PPP_MANAGER_H__ */
|