P2P: Notify about disconnection only when needed

wpas_notify_state_changed() notified about disconnection when
new_state < WPA_ASSOCIATED, without checking the old state. This
results in extra processing which can be avoided by checking that
old_state was connected.

Signed-hostap: Eliad Peller <eliad@wizery.com>
intended-for: hostap-1
This commit is contained in:
Eliad Peller 2012-04-01 21:49:03 +03:00 committed by Jouni Malinen
parent 3c29244eb7
commit dbe7aa2225

View file

@ -82,7 +82,7 @@ void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
if (new_state == WPA_COMPLETED) if (new_state == WPA_COMPLETED)
wpas_p2p_notif_connected(wpa_s); wpas_p2p_notif_connected(wpa_s);
else if (new_state < WPA_ASSOCIATED) else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
wpas_p2p_notif_disconnected(wpa_s); wpas_p2p_notif_disconnected(wpa_s);
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */