@@ -108,7 +108,7 @@ impl ClientService<SampleServiceConfig> for SampleService {
108108 ) ) ) ;
109109
110110 for thread in threads {
111- thread. await . unwrap ( ) . unwrap ( ) ;
111+ thread. await ;
112112 }
113113 } ) ;
114114
@@ -159,14 +159,19 @@ async fn slot_update_loop(
159159 pub_sub : String ,
160160 status_sampler : Arc < Mutex < ClientStatus > > ,
161161) -> anyhow:: Result < ( ) > {
162- let ( mut socket , _response ) = match connect ( Url :: parse ( pub_sub. as_str ( ) ) . unwrap ( ) ) {
162+ let result = match connect ( Url :: parse ( pub_sub. as_str ( ) ) . unwrap ( ) ) {
163163 Ok ( ( socket, _response) ) => Some ( ( socket, _response) ) ,
164164 Err ( _) => {
165165 let mut status = status_sampler. lock ( ) . unwrap ( ) ;
166166 * status = ClientStatus :: Crashed ( String :: from ( "Client can't connect to socket" ) ) ;
167167 None
168168 }
169- } . unwrap ( ) ;
169+ } ;
170+
171+ if result. is_none ( ) {
172+ return Err ( anyhow ! ( "" ) ) ;
173+ }
174+ let ( mut socket, _response) = result. unwrap ( ) ;
170175
171176 socket. write_message ( Message :: Text (
172177 r#"{ "jsonrpc": "2.0", "id": 1, "method": "slotSubscribe" }"# . into ( ) ,
@@ -324,8 +329,9 @@ async fn shred_update_loop(
324329 loop {
325330 {
326331 let mut status = status_sampler. lock ( ) . unwrap ( ) ;
327-
328- if let ClientStatus :: Crashed ( _) = & * status { } else {
332+ if let ClientStatus :: Crashed ( _) = & * status {
333+ return Err ( anyhow ! ( "" ) ) ;
334+ } else {
329335 * status = ClientStatus :: Active ( String :: from (
330336 "Monitoring Tinydancer: Actively Sampling Shreds" ,
331337 ) ) ;
0 commit comments