File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1010client_s = None
1111
1212def setup_conn (port , accept_handler ):
13- global listen_s , client_s
13+ global listen_s
1414 listen_s = socket .socket ()
1515 listen_s .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEADDR , 1 )
1616
@@ -19,11 +19,13 @@ def setup_conn(port, accept_handler):
1919
2020 listen_s .bind (addr )
2121 listen_s .listen (1 )
22- listen_s .setsockopt (socket .SOL_SOCKET , 20 , accept_handler )
22+ if accept_handler :
23+ listen_s .setsockopt (socket .SOL_SOCKET , 20 , accept_handler )
2324 for i in (network .AP_IF , network .STA_IF ):
2425 iface = network .WLAN (i )
2526 if iface .active ():
2627 print ("WebREPL daemon started on ws://%s:%d" % (iface .ifconfig ()[0 ], port ))
28+ return listen_s
2729
2830
2931def accept_conn (listen_sock ):
@@ -65,3 +67,9 @@ def start(port=8266, password=None):
6567 _webrepl .password (password )
6668 setup_conn (port , accept_conn )
6769 print ("Started webrepl in normal mode" )
70+
71+
72+ def start_foreground (port = 8266 ):
73+ stop ()
74+ s = setup_conn (port , None )
75+ accept_conn (s )
You can’t perform that action at this time.
0 commit comments