@@ -24,19 +24,22 @@ async fn main() -> Result<()> {
24
24
lazy_static:: initialize ( & CONFIG ) ;
25
25
debug ! ( "Config: {:?}" , * CONFIG ) ;
26
26
27
- agent:: start_agent ( & CONFIG ) . await ;
28
- info ! ( "TAP Agent started." ) ;
29
-
30
- // Have tokio wait for SIGTERM or SIGINT.
31
- let mut signal_sigint = signal ( SignalKind :: interrupt ( ) ) ?;
32
- let mut signal_sigterm = signal ( SignalKind :: terminate ( ) ) ?;
33
- tokio:: select! {
34
- _ = signal_sigint. recv( ) => debug!( "Received SIGINT." ) ,
35
- _ = signal_sigterm. recv( ) => debug!( "Received SIGTERM." ) ,
27
+ {
28
+ let _manager = agent:: start_agent ( & CONFIG ) . await ;
29
+ info ! ( "TAP Agent started." ) ;
30
+
31
+ // Have tokio wait for SIGTERM or SIGINT.
32
+ let mut signal_sigint = signal ( SignalKind :: interrupt ( ) ) ?;
33
+ let mut signal_sigterm = signal ( SignalKind :: terminate ( ) ) ?;
34
+ tokio:: select! {
35
+ _ = signal_sigint. recv( ) => debug!( "Received SIGINT." ) ,
36
+ _ = signal_sigterm. recv( ) => debug!( "Received SIGTERM." ) ,
37
+ }
38
+
39
+ // If we're here, we've received a signal to exit.
40
+ info ! ( "Shutting down..." ) ;
36
41
}
37
-
38
- // If we're here, we've received a signal to exit.
39
- info ! ( "Shutting down..." ) ;
42
+ // Manager should be successfully dropped here.
40
43
41
44
// Stop the server and wait for it to finish gracefully.
42
45
debug ! ( "Goodbye!" ) ;
0 commit comments