Re: Question in function nm_device_state_changed()



On Wed, 2009-05-06 at 11:40 +0800, 代尔欣 wrote:
> Hi all,
>      I have a question about the NetworkManager-0.7.1 codes.
>      In NetworkManager-0.7.1/src/nm-device.c:
> 
> void nm_device_state_changed (NMDevice *device,
>                          NMDeviceState state,
>                          NMDeviceStateReason reason)
> {
> ...
>     // Here the fifth parameter is set to 0. I think it should be set
> to "reason" so that the receiver of the signal "state-changed" can
> do  

The question is what event is causing the reason to be 0.  Was it a
user-requested disconnection?  Was it something else?  There may
definitely be some places in NM that don't set the code correctly, but
we need to identify which scenario you've hit here.

>     // something special base on the "state change reason". e.g. When
> "NM_DEVICE_STATE_DISCONNECTED" state signaled, if 
>     // the reason is "NM_DEVICE_STATE_REASON_USER_REQUESTED" then we
> do not schedule auto connect in 
>     // NetworkManagerPolicy.c device_state_changed() or 
>     // set a flag in device-related device_state_changed() and reload
> the can_activate() function to check this flag.
>     g_signal_emit_by_name (device, "state-changed", state, old_state,
> 0);
> ...

The reason we probably don't schedule autoconnection on disconnect is
precisely because the user chose to manually disconnect.  If we did
reschedule the autoconnect, then NM would simply reconnect the
connection the user just disconnected.

Dan

> }
> 
> If I'm wrong, please point out. Thanks!
> 
> 
> 
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]