mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 10:30:13 +01:00
core: add nm_active_connection_set_state_fail() helper
This commit is contained in:
parent
c6d0fbe7b0
commit
c027fc5d82
2 changed files with 34 additions and 0 deletions
|
|
@ -292,6 +292,36 @@ nm_active_connection_set_state (NMActiveConnection *self,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nm_active_connection_set_state_fail (NMActiveConnection *self,
|
||||
NMActiveConnectionStateReason reason,
|
||||
const char *error_desc)
|
||||
{
|
||||
NMActiveConnectionState s;
|
||||
|
||||
g_return_if_fail (NM_IS_ACTIVE_CONNECTION (self));
|
||||
|
||||
if (error_desc) {
|
||||
_LOGD ("Failed to activate '%s': %s",
|
||||
nm_active_connection_get_settings_connection_id (self),
|
||||
error_desc);
|
||||
}
|
||||
|
||||
s = nm_active_connection_get_state (self);
|
||||
if ( s >= NM_ACTIVE_CONNECTION_STATE_ACTIVATING
|
||||
&& s < NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
|
||||
nm_active_connection_set_state (self,
|
||||
NM_ACTIVE_CONNECTION_STATE_DEACTIVATING,
|
||||
reason);
|
||||
s = nm_active_connection_get_state (self);
|
||||
}
|
||||
if (s < NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
|
||||
nm_active_connection_set_state (self,
|
||||
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED,
|
||||
reason);
|
||||
}
|
||||
}
|
||||
|
||||
NMActivationStateFlags
|
||||
nm_active_connection_get_state_flags (NMActiveConnection *self)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -148,6 +148,10 @@ void nm_active_connection_set_state (NMActiveConnection *self,
|
|||
NMActiveConnectionState state,
|
||||
NMActiveConnectionStateReason reason);
|
||||
|
||||
void nm_active_connection_set_state_fail (NMActiveConnection *active,
|
||||
NMActiveConnectionStateReason reason,
|
||||
const char *error_desc);
|
||||
|
||||
NMActivationStateFlags nm_active_connection_get_state_flags (NMActiveConnection *self);
|
||||
|
||||
void nm_active_connection_set_state_flags_full (NMActiveConnection *self,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue