Fixed deadlock in external_url (#4354)

This commit is contained in:
Arkadiy Paronyan 2017-01-30 17:08:21 +01:00 committed by Gav Wood
parent 15ffd9a09c
commit 43cc4ea13d

View File

@ -517,13 +517,13 @@ impl Host {
} }
pub fn external_url(&self) -> Option<String> { pub fn external_url(&self) -> Option<String> {
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 { pub fn local_url(&self) -> String {
let r = format!("{}", Node::new(self.info.read().id().clone(), self.info.read().local_endpoint.clone())); let info = self.info.read();
println!("{}", r); format!("{}", Node::new(info.id().clone(), info.local_endpoint.clone()))
r
} }
pub fn stop(&self, io: &IoContext<NetworkIoMessage>) -> Result<(), NetworkError> { pub fn stop(&self, io: &IoContext<NetworkIoMessage>) -> Result<(), NetworkError> {