Skip to content

Commit

Permalink
Upgraded to tokio 1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
sp1ff committed Jul 16, 2023
1 parent a98aaca commit a37c7d2
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 29 deletions.
6 changes: 5 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
2021-12-16 Michael Herstine <[email protected]>
2021-12-30 Michael Herstine <[email protected]>

Upgraded to tokio 1.0.

2021-12-18 Michael Herstine <[email protected]>

Remove Snafu.
After some thought & some research, I decided I want to hand-craft
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ mpdpopm News -- history of user-visible changes -*- outline -*-

* 0.3 builds

** 0.3.2 build

No user-visible changes; strictly a hygiene build (updated to Tokio 1.0).
** 0.3.1 build

No user-visible changes; strictly a hygiene build (re-vamped error-handling throughout).
Expand Down
24 changes: 12 additions & 12 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#+AUTHOR: Michael Herstine
#+DESCRIPTION: mpdpopm
#+EMAIL: [email protected]
#+DATE: <2021-12-16 Thu 18:03>
#+DATE: <2021-12-30 Thu 07:49>
#+AUTODATE: t

* Introduction
Expand Down Expand Up @@ -56,10 +56,10 @@ Thanks to a suggestion by [[https://github.com/m040601][m040601]], you can down

#+BEGIN_SRC bash
cd /tmp
curl -L --output mpdpopm-0.3.1.tar.gz https://github.com/sp1ff/mpdpopm/releases/download/0.3.1/mpdpopm-0.3.1-x86_64-unknown-linux.tar.gz
tar xf mpdpopm-0.3.1.tar.gz
tree mpdpopm-0.3.1-x86_64-unknown-linux/
mpdpopm-0.3.1-x86_64-unknown-linux/
curl -L --output mpdpopm-0.3.2.tar.gz https://github.com/sp1ff/mpdpopm/releases/download/0.3.2/mpdpopm-0.3.2-x86_64-unknown-linux.tar.gz
tar xf mpdpopm-0.3.2.tar.gz
tree mpdpopm-0.3.2-x86_64-unknown-linux/
mpdpopm-0.3.2-x86_64-unknown-linux/
├── bin
│ ├── mppopm
│ └── mppopmd
Expand Down Expand Up @@ -89,8 +89,8 @@ If you're running on a Debian-based Linux distribution, and you're on an x86_64

#+BEGIN_SRC bash
cd /tmp
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.1/mpdpopm_0.3.1_amd64.deb
sudo dpkg -i mpdpopm_0.3.1_amd64.deb
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.2/mpdpopm_0.3.2_amd64.deb
sudo dpkg -i mpdpopm_0.3.2_amd64.deb
#+END_SRC

The binaries will be placed in =/usr/local/bin=, and you can proceed to [[#getting_started][Getting Started]], below.
Expand All @@ -101,8 +101,8 @@ If you're running on an Arch-based Linux distribution, and you're on an x86_64 p

#+BEGIN_SRC bash
cd /tmp
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.1/mpdpopm_0.3.1-1-x86_64.pkg.tar.zst
sudo pacman -U mpdpopm_0.3.1-1-x86_64.pkg.tar.zst
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.2/mpdpopm_0.3.2-1-x86_64.pkg.tar.zst
sudo pacman -U mpdpopm_0.3.2-1-x86_64.pkg.tar.zst
#+END_SRC

The binaries will be placed in =/usr/local/bin=, and you can proceed to [[#getting_started][Getting Started]], below.
Expand All @@ -113,9 +113,9 @@ If you've got the Rust toolchain as well as Autotools installed, you can build f

#+BEGIN_SRC bash
cd /tmp
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.1/mpdpopm-0.3.1.tar.xz
tar xf mpdpopm-0.3.1.tar.xz
cd mpdpopm-0.3.1
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.2/mpdpopm-0.3.2.tar.xz
tar xf mpdpopm-0.3.2.tar.xz
cd mpdpopm-0.3.2
./configure
make
make check
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([mpdpopm], [0.3.1], [[email protected]], [mpdpopm], [https://github.com/sp1ff/mpdpopm])
AC_INIT([mpdpopm], [0.3.2], [[email protected]], [mpdpopm], [https://github.com/sp1ff/mpdpopm])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([mpdpopm/Cargo.toml.in])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability -Wno-override gnits std-options dist-bzip2 dist-xz])
Expand Down
4 changes: 2 additions & 2 deletions doc/version.texi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@set UPDATED 29 March 2021
@set UPDATED-MONTH March 2021
@set EDITION 0.3.1
@set VERSION 0.3.1
@set EDITION 0.3.2
@set VERSION 0.3.2
5 changes: 3 additions & 2 deletions mpdpopm/Cargo.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ boolinator = "2.4.0"
chrono = "0.4.19"
clap = "=3.0.0-beta.1"
errno = "0.2.6"
futures = "0.3.5"
# futures = "0.3.5"
futures = "0.3.19"
lalrpop-util = "0.19"
lazy_static = "1.4.0"
libc = "0.2.74"
Expand All @@ -33,7 +34,7 @@ pin-project = "1.0.8"
regex = "1.3.6"
serde = { version = "1.0", features = ["derive"] }
serde-lexpr = "0.1.1"
tokio = { version = "0.2.22", features = ["dns", "io-util", "macros", "process", "rt-threaded", "signal", "tcp", "time", "uds"] }
tokio = { version = "1.15.0", features = ["io-util", "macros", "net", "process", "rt-multi-thread", "signal", "time"] }

[package.metadata.deb]
maintainer = "@PACKAGE_AUTHOR@"
Expand Down
2 changes: 1 addition & 1 deletion mpdpopm/src/bin/mppopmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ commands to keep your tags up-to-date.",
// One way or another, we are now the "final" process. Announce ourselves...
info!("mppopmd {} logging at level {:#?}.", VERSION, lf);
// spin-up the Tokio runtime...
let mut rt = tokio::runtime::Runtime::new().unwrap();
let rt = tokio::runtime::Runtime::new().unwrap();
// and invoke `mpdpopm'.
rt.block_on(mpdpopm(cfg)).map_err(|err| Error::MpdPopm {
source: err,
Expand Down
8 changes: 3 additions & 5 deletions mpdpopm/src/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ use async_trait::async_trait;
use backtrace::Backtrace;
use log::{debug, info};
use regex::Regex;
use tokio::{
net::{TcpStream, ToSocketAddrs, UnixStream},
prelude::*,
};
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tokio::net::{TcpStream, ToSocketAddrs, UnixStream};

use lazy_static::lazy_static;

Expand Down Expand Up @@ -463,7 +461,7 @@ where
/// Utility function to parse the initial response to a connection from mpd
async fn parse_connect_rsp<T>(sock: &mut T) -> Result<String>
where
T: AsyncRead + AsyncWrite + Send + Unpin,
T: AsyncReadExt + AsyncWriteExt + Send + Unpin,
{
let mut buf = Vec::with_capacity(32);
let _cb = sock.read_buf(&mut buf).await?;
Expand Down
2 changes: 0 additions & 2 deletions mpdpopm/src/filters.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ pub Token: Value = {
error: "Internal parse error while parsing unsigned int" })
}
},
// TODO(sp1ff): use =>?
<s:r#""([ \t'a-zA-Z0-9~!@#$%^&*()-=_+\[\]{}|;:<>,./?]|\\\\|\\"|\\')+""#> => {
eprintln!("matched token: ``{}''.", s);
let s = expect_quoted(s).unwrap();
Expand All @@ -84,7 +83,6 @@ pub Token: Value = {
Err(_) => Value::Text(s),
}
},
// TODO(sp1ff): use =>?
<s:r#"'([ \t"a-zA-Z0-9~!@#$%^&*()-=_+\[\]{}|;:<>,./?]|\\\\|\\'|\\")+'"#> => {
eprintln!("matched token: ``{}''.", s);
let s = expect_quoted(s).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions mpdpopm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use log::{debug, error, info};
use tokio::{
signal,
signal::unix::{signal, SignalKind},
time::{delay_for, Duration},
time::{sleep, Duration},
};

use std::path::PathBuf;
Expand Down Expand Up @@ -187,7 +187,7 @@ pub async fn mpdpopm(cfg: Config) -> std::result::Result<(), Error> {
let sighup = hup.recv().fuse();
let sigkill = kill.recv().fuse();

let tick = delay_for(Duration::from_millis(cfg.poll_interval_ms)).fuse();
let tick = sleep(Duration::from_millis(cfg.poll_interval_ms)).fuse();
pin_mut!(ctrl_c, sighup, sigkill, tick);

let mut cmds = FuturesUnordered::<std::pin::Pin<std::boxed::Box<TaggedCommandFuture>>>::new();
Expand Down Expand Up @@ -245,7 +245,7 @@ pub async fn mpdpopm(cfg: Config) -> std::result::Result<(), Error> {
break;
},
_ = tick => {
tick.set(delay_for(Duration::from_millis(cfg.poll_interval_ms)).fuse());
tick.set(sleep(Duration::from_millis(cfg.poll_interval_ms)).fuse());
if let Some(fut) = state.update(&mut client,
&cfg.playcount_command,
&mut cfg.playcount_command_args
Expand Down

0 comments on commit a37c7d2

Please sign in to comment.