File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,12 @@ async fn tokio_main(
123
123
error ! ( "{} 🔌 USB init error: {}" , NAME , e) ;
124
124
}
125
125
126
+ let bt_stop;
126
127
loop {
127
128
match bluetooth_setup_connection ( advertise, connect, tcp_start. clone ( ) ) . await {
128
129
Ok ( state) => {
129
130
// we're ready, gracefully shutdown bluetooth in task
130
- tokio:: spawn ( async move { bluetooth_stop ( state) . await } ) ;
131
+ bt_stop = tokio:: spawn ( async move { bluetooth_stop ( state) . await } ) ;
131
132
break ;
132
133
}
133
134
Err ( e) => {
@@ -141,6 +142,9 @@ async fn tokio_main(
141
142
usb. enable_default_and_wait_for_accessory ( accessory_started. clone ( ) )
142
143
. await ;
143
144
145
+ // wait for bluetooth stop properly
146
+ let _ = bt_stop. await ;
147
+
144
148
// wait for restart
145
149
need_restart. notified ( ) . await ;
146
150
You can’t perform that action at this time.
0 commit comments