@@ -243,15 +243,17 @@ pub fn main_loop(
243243 break ;
244244 } ;
245245 }
246- loop_turn (
246+ if let Some ( new_server_config ) = loop_turn (
247247 & pool,
248248 & task_sender,
249249 & libdata_sender,
250250 & connection,
251251 & mut world_state,
252252 & mut loop_state,
253253 event,
254- ) ?;
254+ ) ? {
255+ dbg ! ( new_server_config) ;
256+ }
255257 }
256258 }
257259 world_state. analysis_host . request_cancellation ( ) ;
@@ -361,7 +363,7 @@ fn loop_turn(
361363 world_state : & mut WorldState ,
362364 loop_state : & mut LoopState ,
363365 event : Event ,
364- ) -> Result < ( ) > {
366+ ) -> Result < Option < ServerConfig > > {
365367 let loop_start = Instant :: now ( ) ;
366368
367369 // NOTE: don't count blocking select! call as a loop-turn time
@@ -372,6 +374,8 @@ fn loop_turn(
372374 log:: info!( "queued count = {}" , queue_count) ;
373375 }
374376
377+ let mut new_server_config = None ;
378+
375379 match event {
376380 Event :: Task ( task) => {
377381 on_task ( task, & connection. sender , & mut loop_state. pending_requests , world_state) ;
@@ -401,15 +405,20 @@ fn loop_turn(
401405 on_notification ( & connection. sender , world_state, loop_state, not) ?;
402406 }
403407 Message :: Response ( resp) => {
404- if Some ( & resp. id ) == loop_state. configuration_request_id . as_ref ( ) {
405- loop_state. configuration_request_id . take ( ) ;
406- eprintln ! ( "!!!!!!!!!!!!!!1" ) ;
407- dbg ! ( & resp) ;
408- }
409408 let removed = loop_state. pending_responses . remove ( & resp. id ) ;
410409 if !removed {
411410 log:: error!( "unexpected response: {:?}" , resp)
412411 }
412+ if Some ( & resp. id ) == loop_state. configuration_request_id . as_ref ( ) {
413+ loop_state. configuration_request_id . take ( ) ;
414+ let new_config =
415+ serde_json:: from_value :: < Vec < ServerConfig > > ( resp. result . unwrap ( ) )
416+ . unwrap ( )
417+ . first ( )
418+ . unwrap ( )
419+ . to_owned ( ) ;
420+ new_server_config = Some ( new_config) ;
421+ }
413422 }
414423 } ,
415424 } ;
@@ -479,7 +488,7 @@ fn loop_turn(
479488 }
480489 }
481490
482- Ok ( ( ) )
491+ Ok ( new_server_config )
483492}
484493
485494fn on_task (
0 commit comments