From 43cc4ea13dec86cc4721f85bdbd8cc0e151bd5a2 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Mon, 30 Jan 2017 17:08:21 +0100 Subject: [PATCH] Fixed deadlock in external_url (#4354) --- util/network/src/host.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/network/src/host.rs b/util/network/src/host.rs index b5a19cc92..98efbd6a0 100644 --- a/util/network/src/host.rs +++ b/util/network/src/host.rs @@ -517,13 +517,13 @@ impl Host { } pub fn external_url(&self) -> Option { - self.info.read().public_endpoint.as_ref().map(|e| format!("{}", Node::new(self.info.read().id().clone(), e.clone()))) + let info = self.info.read(); + info.public_endpoint.as_ref().map(|e| format!("{}", Node::new(info.id().clone(), e.clone()))) } pub fn local_url(&self) -> String { - let r = format!("{}", Node::new(self.info.read().id().clone(), self.info.read().local_endpoint.clone())); - println!("{}", r); - r + let info = self.info.read(); + format!("{}", Node::new(info.id().clone(), info.local_endpoint.clone())) } pub fn stop(&self, io: &IoContext) -> Result<(), NetworkError> {