Passing listen address as &str

pull/9/head
Dennis Schwerdel 2016-02-08 20:15:31 +01:00
parent f860d487e9
commit c07d772b90
2 changed files with 3 additions and 3 deletions

View File

@ -105,10 +105,10 @@ pub struct GenericCloud<P: Protocol> {
}
impl<P: Protocol> GenericCloud<P> {
pub fn new(device: Device, listen: String, network_id: Option<NetworkId>, table: Box<Table>,
pub fn new(device: Device, listen: &str, network_id: Option<NetworkId>, table: Box<Table>,
peer_timeout: Duration, learning: bool, broadcast: bool, addresses: Vec<Range>,
crypto: Crypto) -> Self {
let socket = match UdpSocket::bind(&listen as &str) {
let socket = match UdpSocket::bind(listen) {
Ok(socket) => socket,
_ => fail!("Failed to open socket {}", listen)
};

View File

@ -122,7 +122,7 @@ fn run<T: Protocol> (args: Args) {
Some(key) => Crypto::from_shared_key(args.flag_crypto, &key),
None => Crypto::None
};
let mut cloud = GenericCloud::<T>::new(device, args.flag_listen, network_id, table, peer_timeout, learning, broadcasting, ranges, crypto);
let mut cloud = GenericCloud::<T>::new(device, &args.flag_listen, network_id, table, peer_timeout, learning, broadcasting, ranges, crypto);
if let Some(script) = args.flag_ifup {
run_script(script, cloud.ifname());
}