@@ -11,7 +11,6 @@ pub(crate) mod errors;
1111pub ( crate ) mod http_gateway;
1212pub ( crate ) mod path_handlers;
1313
14- use std:: collections:: HashMap ;
1514use std:: net:: SocketAddr ;
1615use std:: sync:: Arc ;
1716use std:: time:: { Duration , Instant } ;
@@ -139,10 +138,8 @@ pub mod local_node {
139138 ClientRequest :: DelegateOp ( op) => {
140139 let attested_contract = token. and_then ( |token| {
141140 gw. attested_contracts
142- . read ( )
143- . map ( |guard| guard. get ( & token) . cloned ( ) . map ( |( t, _, _) | t) )
144- . ok ( )
145- . flatten ( )
141+ . get ( & token)
142+ . map ( |entry| entry. contract_id . clone ( ) )
146143 } ) ;
147144 executor. delegate_request ( op, attested_contract. as_ref ( ) )
148145 }
@@ -151,14 +148,10 @@ pub mod local_node {
151148 tracing:: info!( "disconnecting cause: {cause}" ) ;
152149 }
153150 // fixme: token must live for a bit to allow reconnections
154- if let Some ( rm_token) = gw
155- . attested_contracts
156- . iter ( )
157- . find_map ( |entry| {
158- let ( k, attested) = entry. pair ( ) ;
159- ( attested. client_id == id) . then ( || k. clone ( ) )
160- } )
161- {
151+ if let Some ( rm_token) = gw. attested_contracts . iter ( ) . find_map ( |entry| {
152+ let ( k, attested) = entry. pair ( ) ;
153+ ( attested. client_id == id) . then ( || k. clone ( ) )
154+ } ) {
162155 gw. attested_contracts . remove ( & rm_token) ;
163156 }
164157 continue ;
0 commit comments