Skip to content

Commit 19be199

Browse files
committed
Add short delay before disconnecting user
1 parent 0effcbb commit 19be199

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/common/wifi.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from common.errors import WifiNoSuitableDevice
1212
from common.nm_dicts import get_nm_dict
1313
from common.system import led
14+
from time import sleep
1415

1516

1617
# Import DBus mainloop for NetworkManager use
@@ -176,13 +177,19 @@ def forget(create_new_hotspot=False, all_networks=False):
176177
== "802-11-wireless":
177178
# Delete the identified connection
178179
network_id = connection.GetSettings()["connection"]["id"]
180+
# Add short delay to ensure the endpoint has returned a
181+
# response before disconnecting the user.
182+
sleep(0.5)
179183
connection.Delete()
180184
logger.debug(f"Deleted connection: {network_id}")
181185
else:
182186
connection_id = get_connection_id()
183187
# connection_id returns false if it is missing. This can be ignored
184188
# as this function is often called as a precautionary clean up
185189
if connection_id:
190+
# Add short delay to ensure the endpoint has returned a
191+
# response before disconnecting the user.
192+
sleep(0.5)
186193
connection_id.Delete()
187194
logger.debug(f"Deleted connection: {config.ap_name}")
188195

0 commit comments

Comments
 (0)