Skip to content

Commit

Permalink
fsm: always refresh worker on device-ready event (bnc#904061)
Browse files Browse the repository at this point in the history
  • Loading branch information
wipawel committed Nov 21, 2014
1 parent 4bd89f6 commit 5bd9c73
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions src/fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4400,6 +4400,29 @@ interface_state_change_signal(ni_dbus_connection_t *conn, ni_dbus_message_t *msg
if (event_type == NI_EVENT_ADDRESS_ACQUIRED)
fsm->last_event_seq[NI_EVENT_ADDRESS_ACQUIRED] = fsm->event_seq;

if (event_type == NI_EVENT_DEVICE_READY) {
/* Refresh device on create */
if (!(w = ni_fsm_recv_new_netif_path(fsm, object_path))) {
ni_error("%s: Cannot find corresponding worker for %s",
__func__, object_path);
return;
}

/* Rebuild hierarchy */
ni_fsm_refresh_master_dev(fsm, w);
ni_fsm_refresh_lower_dev(fsm, w);

/* Rebuild hierarchy in case of new device shows up */
ni_fsm_build_hierarchy(fsm, FALSE);

/* Handle devices which were not present on ifup */
if(w->pending) {
w->pending = FALSE;
ni_ifworker_start(fsm, w, fsm->worker_timeout);
goto done;
}
}

if ((w = ni_fsm_ifworker_by_object_path(fsm, object_path)) != NULL) {
ni_objectmodel_callback_info_t *cb = NULL;

Expand Down Expand Up @@ -4468,27 +4491,6 @@ interface_state_change_signal(ni_dbus_connection_t *conn, ni_dbus_message_t *msg
goto done;
}

if (event_type == NI_EVENT_DEVICE_READY) {
/* Refresh device on create */
if (!w->device) {
w = ni_fsm_recv_new_netif_path(fsm, object_path);

/* Rebuild hierarchy */
ni_fsm_refresh_master_dev(fsm, w);
ni_fsm_refresh_lower_dev(fsm, w);
}

/* Rebuild hierarchy in case of new device shows up */
ni_fsm_build_hierarchy(fsm, FALSE);

/* Handle devices which were not present on ifup */
if(w->pending) {
w->pending = FALSE;
ni_ifworker_start(fsm, w, fsm->worker_timeout);
goto done;
}
}

ni_ifworker_advance_state(w, event_type);
}

Expand Down

0 comments on commit 5bd9c73

Please sign in to comment.