@@ -195,7 +195,8 @@ async fn tokio_main(
195195 let accessory_started = Arc :: new ( Notify :: new ( ) ) ;
196196 let accessory_started_cloned = accessory_started. clone ( ) ;
197197
198- if let Some ( ref bindaddr) = config. read ( ) . await . webserver {
198+ let cfg = config. read ( ) . await . clone ( ) ;
199+ if let Some ( ref bindaddr) = cfg. webserver {
199200 // preparing AppState and starting webserver
200201 let state = web:: AppState {
201202 config : config. clone ( ) ,
@@ -226,28 +227,22 @@ async fn tokio_main(
226227 }
227228
228229 let wifi_conf = {
229- if !config. read ( ) . await . wired . is_some ( ) {
230- Some ( init_wifi_config (
231- & config. read ( ) . await . iface ,
232- config. read ( ) . await . hostapd_conf . clone ( ) ,
233- ) )
230+ if !cfg. wired . is_some ( ) {
231+ Some ( init_wifi_config ( & cfg. iface , cfg. hostapd_conf . clone ( ) ) )
234232 } else {
235233 None
236234 }
237235 } ;
238236 let mut usb = None ;
239- if !config . read ( ) . await . dhu {
240- if config . read ( ) . await . legacy {
237+ if !cfg . dhu {
238+ if cfg . legacy {
241239 // start uevent listener in own task
242240 std:: thread:: spawn ( || uevent_listener ( accessory_started_cloned) ) ;
243241 }
244- usb = Some ( UsbGadgetState :: new (
245- config. read ( ) . await . legacy ,
246- config. read ( ) . await . udc . clone ( ) ,
247- ) ) ;
242+ usb = Some ( UsbGadgetState :: new ( cfg. legacy , cfg. udc . clone ( ) ) ) ;
248243 }
249244
250- let change_usb_order = config . read ( ) . await . change_usb_order ;
245+ let change_usb_order = cfg . change_usb_order ;
251246 loop {
252247 // check if we need to reboot
253248 action_handler ( & mut config) . await ?;
0 commit comments