I think the code here is trying to sync the current wifi state and wifi.enabled.