File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ def connect(conn_type=config.type_hotspot,
178
178
elif conn_type != config .type_hotspot :
179
179
# Restart hotspot as connection failed
180
180
logger .warning ("Connection attempt failed." )
181
- start_hotspot ()
181
+ connect ()
182
182
else :
183
183
raise WifiHotspotStartFailed
184
184
except Exception :
@@ -187,7 +187,7 @@ def connect(conn_type=config.type_hotspot,
187
187
if conn_type == config .type_hotspot :
188
188
raise WifiHotspotStartFailed
189
189
else :
190
- start_hotspot () # Restart hotspot as connection failed
190
+ connect () # Restart hotspot as connection failed
191
191
raise WifiConnectionFailed
192
192
193
193
@@ -224,7 +224,8 @@ def forget(create_new_hotspot=False):
224
224
conn .Delete ()
225
225
226
226
if create_new_hotspot :
227
- start_hotspot ()
227
+ refresh_networks ()
228
+ connect ()
228
229
229
230
except Exception :
230
231
logger .exception ("Failed to delete network." )
@@ -321,12 +322,3 @@ def refresh_networks(retries=5):
321
322
logger .warning ("IW is not accessible. This can happen on some devices "
322
323
"and is usually nothing to worry about." )
323
324
return False
324
-
325
-
326
- def start_hotspot ():
327
- # On some devices, fetching available wifi networks in the area is only
328
- # possible before the hotspot is started and therefore called here.
329
- refresh_networks ()
330
-
331
- # Start the connection
332
- return connect ()
Original file line number Diff line number Diff line change 6
6
from common .errors import logger
7
7
from common .wifi import check_wifi_status
8
8
from common .wifi import dnsmasq
9
- from common .wifi import start_hotspot
9
+ from common .wifi import connect
10
+ from common .wifi import refresh_networks
10
11
from resources .system_routes import system_health_check
11
12
from resources .wifi_routes import wifi_connect
12
13
from resources .wifi_routes import wifi_connection_status
@@ -49,7 +50,8 @@ def handle_sigterm(*args):
49
50
logger .info ('Wi-Fi connection already established.' )
50
51
else :
51
52
logger .info ('Starting hotspot...' )
52
- start_hotspot ()
53
+ refresh_networks (retries = 1 )
54
+ connect ()
53
55
54
56
# Configure endpoints #
55
57
You can’t perform that action at this time.
0 commit comments