From 630de8c0a9b09981f5cdfa418fd26a07756665bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Jan 2018 20:38:30 +0100 Subject: [PATCH] Use futures::sync::mpsc::UnboundedSender::unbounded_send() instead of the deprecated send() --- audio/src/fetch.rs | 2 +- core/src/channel.rs | 2 +- core/src/mercury/mod.rs | 2 +- core/src/session.rs | 2 +- src/discovery.rs | 2 +- src/spirc.rs | 16 ++++++++-------- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/audio/src/fetch.rs b/audio/src/fetch.rs index df5eeef..f9bd11a 100644 --- a/audio/src/fetch.rs +++ b/audio/src/fetch.rs @@ -340,7 +340,7 @@ impl Seek for AudioFileStreaming { // Notify the fetch thread to get the correct block // This can fail if fetch thread has completed, in which case the // block is ready. Just ignore the error. - let _ = self.seek.send(self.position); + let _ = self.seek.unbounded_send(self.position); Ok(self.position) } } diff --git a/core/src/channel.rs b/core/src/channel.rs index 30a9e00..8370da4 100644 --- a/core/src/channel.rs +++ b/core/src/channel.rs @@ -61,7 +61,7 @@ impl ChannelManager { self.lock(|inner| { if let Entry::Occupied(entry) = inner.channels.entry(id) { - let _ = entry.get().send((cmd, data)); + let _ = entry.get().unbounded_send((cmd, data)); } }); } diff --git a/core/src/mercury/mod.rs b/core/src/mercury/mod.rs index 45e12f1..3751487 100644 --- a/core/src/mercury/mod.rs +++ b/core/src/mercury/mod.rs @@ -211,7 +211,7 @@ impl MercuryManager { // if send fails, remove from list of subs // TODO: send unsub message - sub.send(response.clone()).is_ok() + sub.unbounded_send(response.clone()).is_ok() } else { // URI doesn't match true diff --git a/core/src/session.rs b/core/src/session.rs index 067b685..1534d3e 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -177,7 +177,7 @@ impl Session { } pub fn send_packet(&self, cmd: u8, data: Vec) { - self.0.tx_connection.send((cmd, data)).unwrap(); + self.0.tx_connection.unbounded_send((cmd, data)).unwrap(); } pub fn cache(&self) -> Option<&Arc> { diff --git a/src/discovery.rs b/src/discovery.rs index 46f44dd..0b6e4ad 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -136,7 +136,7 @@ impl Discovery { let credentials = Credentials::with_blob(username.to_owned(), &decrypted, &self.0.device_id); - self.0.tx.send(credentials).unwrap(); + self.0.tx.unbounded_send(credentials).unwrap(); let result = json!({ "status": 101, diff --git a/src/spirc.rs b/src/spirc.rs index f2265a6..a36d0b1 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -177,28 +177,28 @@ impl Spirc { } pub fn play(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Play); + let _ = self.commands.unbounded_send(SpircCommand::Play); } pub fn play_pause(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::PlayPause); + let _ = self.commands.unbounded_send(SpircCommand::PlayPause); } pub fn pause(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Pause); + let _ = self.commands.unbounded_send(SpircCommand::Pause); } pub fn prev(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Prev); + let _ = self.commands.unbounded_send(SpircCommand::Prev); } pub fn next(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Next); + let _ = self.commands.unbounded_send(SpircCommand::Next); } pub fn volume_up(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::VolumeUp); + let _ = self.commands.unbounded_send(SpircCommand::VolumeUp); } pub fn volume_down(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::VolumeDown); + let _ = self.commands.unbounded_send(SpircCommand::VolumeDown); } pub fn shutdown(&self) { - let _ = mpsc::UnboundedSender::send(&self.commands, SpircCommand::Shutdown); + let _ = self.commands.unbounded_send(SpircCommand::Shutdown); } }