Merge branch 'master' into kill_unwraps

This commit is contained in:
Gav Wood
2016-07-08 17:31:30 +02:00
19 changed files with 283 additions and 69 deletions

View File

@@ -72,7 +72,7 @@ pub trait Lockable<T> {
fn locked(&self) -> MutexGuard<T>;
}
impl<T: Sized> Lockable<T> for Mutex<T> {
impl<T> Lockable<T> for Mutex<T> {
fn locked(&self) -> MutexGuard<T> { self.lock().unwrap() }
}
@@ -85,7 +85,7 @@ pub trait RwLockable<T> {
fn unwrapped_write(&self) -> RwLockWriteGuard<T>;
}
impl<T: Sized> RwLockable<T> for RwLock<T> {
impl<T> RwLockable<T> for RwLock<T> {
fn unwrapped_read(&self) -> RwLockReadGuard<T> { self.read().unwrap() }
fn unwrapped_write(&self) -> RwLockWriteGuard<T> { self.write().unwrap() }
}

View File

@@ -79,6 +79,11 @@ impl<Message> NetworkService<Message> where Message: Send + Sync + Clone + 'stat
&self.stats
}
/// Returns network configuration.
pub fn config(&self) -> &NetworkConfiguration {
&self.config
}
/// Returns external url if available.
pub fn external_url(&self) -> Option<String> {
let host = self.host.unwrapped_read();