@@ -8,7 +8,6 @@ use anyhow::anyhow;
88use futures:: { FutureExt , TryFutureExt } ;
99use serde:: { Deserialize , Serialize } ;
1010use tokio:: sync:: oneshot:: { self , Sender } ;
11- use tokio_util:: sync:: CancellationToken ;
1211use tower:: { Service , ServiceExt } ;
1312
1413use cuprate_blockchain:: service:: { BlockchainReadHandle , BlockchainWriteHandle } ;
@@ -24,7 +23,7 @@ use cuprate_types::blockchain::BlockchainWriteRequest;
2423use crate :: {
2524 blockchain,
2625 config:: Config ,
27- constants :: PANIC_CRITICAL_SERVICE_ERROR ,
26+ supervisor :: ShutdownHandle ,
2827 tor:: { transport_clearnet_daemon_config, transport_daemon_config, TorContext , TorMode } ,
2928 txpool:: { self , IncomingTxHandler } ,
3029} ;
@@ -100,7 +99,7 @@ pub async fn initialize_clearnet_p2p(
10099 blockchain_read_handle : BlockchainReadHandle ,
101100 txpool_read_handle : TxpoolReadHandle ,
102101 tor_ctx : & TorContext ,
103- shutdown_token : CancellationToken ,
102+ shutdown_handle : ShutdownHandle ,
104103) -> ( NetworkInterface < ClearNet > , Sender < IncomingTxHandler > ) {
105104 match config. p2p . clear_net . proxy {
106105 ProxySettings :: Tor => match tor_ctx. mode {
@@ -113,7 +112,7 @@ pub async fn initialize_clearnet_p2p(
113112 txpool_read_handle,
114113 config. clearnet_p2p_config ( ) ,
115114 transport_clearnet_arti_config ( tor_ctx) ,
116- shutdown_token ,
115+ shutdown_handle ,
117116 )
118117 . await
119118 . unwrap ( )
@@ -124,7 +123,7 @@ pub async fn initialize_clearnet_p2p(
124123 txpool_read_handle,
125124 config. clearnet_p2p_config ( ) ,
126125 transport_clearnet_daemon_config ( config) ,
127- shutdown_token ,
126+ shutdown_handle ,
128127 )
129128 . await
130129 . unwrap ( ) ,
@@ -138,7 +137,7 @@ pub async fn initialize_clearnet_p2p(
138137 txpool_read_handle,
139138 config. clearnet_p2p_config ( ) ,
140139 config. p2p . clear_net . tcp_transport_config ( config. network ) ,
141- shutdown_token . clone ( ) ,
140+ shutdown_handle . clone ( ) ,
142141 )
143142 . await
144143 . unwrap ( )
@@ -152,7 +151,7 @@ pub async fn initialize_clearnet_p2p(
152151 client_config : socks_proxy_str_to_config ( s) . unwrap ( ) ,
153152 server_config : None ,
154153 } ,
155- shutdown_token . clone ( ) ,
154+ shutdown_handle . clone ( ) ,
156155 )
157156 . await
158157 . unwrap ( )
@@ -169,7 +168,7 @@ pub async fn start_tor_p2p(
169168 blockchain_read_handle : BlockchainReadHandle ,
170169 txpool_read_handle : TxpoolReadHandle ,
171170 tor_ctx : TorContext ,
172- shutdown_token : CancellationToken ,
171+ shutdown_handle : ShutdownHandle ,
173172) -> ( NetworkInterface < Tor > , Sender < IncomingTxHandler > ) {
174173 match tor_ctx. mode {
175174 TorMode :: Daemon => start_zone_p2p :: < Tor , Daemon > (
@@ -178,7 +177,7 @@ pub async fn start_tor_p2p(
178177 txpool_read_handle,
179178 config. tor_p2p_config ( & tor_ctx) ,
180179 transport_daemon_config ( config) ,
181- shutdown_token ,
180+ shutdown_handle ,
182181 )
183182 . await
184183 . unwrap ( ) ,
@@ -189,7 +188,7 @@ pub async fn start_tor_p2p(
189188 txpool_read_handle,
190189 config. tor_p2p_config ( & tor_ctx) ,
191190 transport_arti_config ( config, tor_ctx) ,
192- shutdown_token ,
191+ shutdown_handle ,
193192 )
194193 . await
195194 . unwrap ( ) ,
@@ -207,7 +206,7 @@ pub async fn start_zone_p2p<N, T>(
207206 txpool_read_handle : TxpoolReadHandle ,
208207 config : P2PConfig < N > ,
209208 transport_config : TransportConfig < N , T > ,
210- shutdown_token : CancellationToken ,
209+ shutdown_handle : ShutdownHandle ,
211210) -> Result < ( NetworkInterface < N > , Sender < IncomingTxHandler > ) , tower:: BoxError >
212211where
213212 N : NetworkZone ,
@@ -221,7 +220,7 @@ where
221220 blockchain_read_handle,
222221 blockchain_context_service : blockchain_context_service. clone ( ) ,
223222 txpool_read_handle,
224- shutdown_token ,
223+ shutdown_handle ,
225224 incoming_tx_handler : None ,
226225 incoming_tx_handler_fut : incoming_tx_handler_rx. shared ( ) ,
227226 } ;
0 commit comments