Skip to content

Commit

Permalink
Remove unnecessary clone
Browse files Browse the repository at this point in the history
  • Loading branch information
junha1 committed May 1, 2023
1 parent f9899ad commit d619320
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions network/src/dms/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ impl<S: Storage, M: DmsMessage> DistributedMessageSet<S, M> {
) -> Result<(), Error> {
let rpc_task = async move {
let wrapped_dms = Arc::new(parking_lot::RwLock::new(Some(dms)));
let wrapped_dms_ = Arc::clone(&wrapped_dms);
struct DropHelper<T> {
wrapped_dms: Arc<parking_lot::RwLock<Option<Arc<RwLock<T>>>>>,
}
Expand All @@ -17,12 +16,14 @@ impl<S: Storage, M: DmsMessage> DistributedMessageSet<S, M> {
self.wrapped_dms.write().take().unwrap();
}
}
let _drop_helper = DropHelper { wrapped_dms };
let _drop_helper = DropHelper {
wrapped_dms: Arc::clone(&wrapped_dms),
};
run_server(
network_config.port,
[(
"dms".to_owned(),
create_http_object(Arc::new(DmsWrapper { dms: wrapped_dms_ })
create_http_object(Arc::new(DmsWrapper { dms: wrapped_dms })
as Arc<dyn DistributedMessageSetRpcInterface>),
)]
.iter()
Expand Down

0 comments on commit d619320

Please sign in to comment.