@@ -243,15 +243,17 @@ pub fn main_loop(
243
243
break ;
244
244
} ;
245
245
}
246
- loop_turn (
246
+ if let Some ( new_server_config ) = loop_turn (
247
247
& pool,
248
248
& task_sender,
249
249
& libdata_sender,
250
250
& connection,
251
251
& mut world_state,
252
252
& mut loop_state,
253
253
event,
254
- ) ?;
254
+ ) ? {
255
+ dbg ! ( new_server_config) ;
256
+ }
255
257
}
256
258
}
257
259
world_state. analysis_host . request_cancellation ( ) ;
@@ -361,7 +363,7 @@ fn loop_turn(
361
363
world_state : & mut WorldState ,
362
364
loop_state : & mut LoopState ,
363
365
event : Event ,
364
- ) -> Result < ( ) > {
366
+ ) -> Result < Option < ServerConfig > > {
365
367
let loop_start = Instant :: now ( ) ;
366
368
367
369
// NOTE: don't count blocking select! call as a loop-turn time
@@ -372,6 +374,8 @@ fn loop_turn(
372
374
log:: info!( "queued count = {}" , queue_count) ;
373
375
}
374
376
377
+ let mut new_server_config = None ;
378
+
375
379
match event {
376
380
Event :: Task ( task) => {
377
381
on_task ( task, & connection. sender , & mut loop_state. pending_requests , world_state) ;
@@ -401,15 +405,20 @@ fn loop_turn(
401
405
on_notification ( & connection. sender , world_state, loop_state, not) ?;
402
406
}
403
407
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
- }
409
408
let removed = loop_state. pending_responses . remove ( & resp. id ) ;
410
409
if !removed {
411
410
log:: error!( "unexpected response: {:?}" , resp)
412
411
}
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
+ }
413
422
}
414
423
} ,
415
424
} ;
@@ -479,7 +488,7 @@ fn loop_turn(
479
488
}
480
489
}
481
490
482
- Ok ( ( ) )
491
+ Ok ( new_server_config )
483
492
}
484
493
485
494
fn on_task (
0 commit comments