diff --git a/.gitignore b/.gitignore index fdcf6c9..90ce968 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /mio-0.6.12.crate /mio-0.6.13.crate +/mio-0.6.14.crate diff --git a/0001-deps-update-slab-to-0.4.patch b/0001-deps-update-slab-to-0.4.patch deleted file mode 100644 index cf9c2fa..0000000 --- a/0001-deps-update-slab-to-0.4.patch +++ /dev/null @@ -1,427 +0,0 @@ -From e327ff6cbdabcd4953bc551590c6e70384b1caf8 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 10 Jan 2018 13:20:09 +0100 -Subject: [PATCH] deps: update slab to 0.4 - -Signed-off-by: Igor Gnatenko ---- - src/lib.rs | 1 + - src/timer.rs | 74 ++++++++----------------------------------- - test/test_battery.rs | 13 +++----- - test/test_echo_server.rs | 13 +++----- - test/test_uds_shutdown.rs | 13 +++----- - test/test_unix_echo_server.rs | 13 +++----- - test/test_unix_pass_fd.rs | 13 +++----- - 7 files changed, 39 insertions(+), 101 deletions(-) - -diff --git a/src/lib.rs b/src/lib.rs -index a0ce92a..3d04516 100644 ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -83,6 +83,7 @@ - extern crate lazycell; - extern crate net2; - extern crate iovec; -+extern crate slab; - - #[cfg(target_os = "fuchsia")] - extern crate fuchsia_zircon as zircon; -diff --git a/src/timer.rs b/src/timer.rs -index 3d9a4f6..c77e37f 100644 ---- a/src/timer.rs -+++ b/src/timer.rs -@@ -2,18 +2,15 @@ - - #![allow(deprecated, missing_debug_implementations)] - --extern crate slab; -- - use {convert, io, Ready, Poll, PollOpt, Registration, SetReadiness, Token}; - use event::Evented; - use lazycell::LazyCell; --use std::{cmp, error, fmt, u64, usize, iter, thread}; -+use slab::Slab; -+use std::{cmp, fmt, u64, usize, iter, thread}; - use std::sync::Arc; - use std::sync::atomic::{AtomicUsize, Ordering}; - use std::time::{Duration, Instant}; - --use self::TimerErrorKind::TimerOverflow; -- - pub struct Timer { - // Size of each tick in milliseconds - tick_ms: u64, -@@ -94,24 +91,9 @@ const TICK_MAX: Tick = u64::MAX; - // Manages communication with wakeup thread - type WakeupState = Arc; - --type Slab = slab::Slab; -- --pub type Result = ::std::result::Result; -+pub type Result = ::std::result::Result; - // TODO: remove - pub type TimerResult = Result; -- -- --#[derive(Debug)] --pub struct TimerError { -- kind: TimerErrorKind, -- desc: &'static str, --} -- --#[derive(Debug)] --pub enum TimerErrorKind { -- TimerOverflow, --} -- - // TODO: Remove - pub type OldTimerResult = Result; - -@@ -192,13 +174,13 @@ impl Timer { - let curr = self.wheel[slot]; - - // Insert the new entry -- let token = self.entries.insert(Entry::new(state, tick, curr.head)) -- .map_err(|_| TimerError::overflow())?; -+ let entry = Entry::new(state, tick, curr.head); -+ let token = Token(self.entries.insert(entry)); - - if curr.head != EMPTY { - // If there was a previous entry, set its prev pointer to the new - // entry -- self.entries[curr.head].links.prev = token; -+ self.entries[curr.head.into()].links.prev = token; - } - - // Update the head slot -@@ -219,7 +201,7 @@ impl Timer { - } - - pub fn cancel_timeout(&mut self, timeout: &Timeout) -> Option { -- let links = match self.entries.get(timeout.token) { -+ let links = match self.entries.get(timeout.token.into()) { - Some(e) => e.links, - None => return None - }; -@@ -230,7 +212,7 @@ impl Timer { - } - - self.unlink(&links, timeout.token); -- self.entries.remove(timeout.token).map(|e| e.state) -+ Some(self.entries.remove(timeout.token.into()).state) - } - - pub fn poll(&mut self) -> Option { -@@ -271,7 +253,7 @@ impl Timer { - self.wheel[slot].next_tick = TICK_MAX; - } - -- let links = self.entries[curr].links; -+ let links = self.entries[curr.into()].links; - - if links.tick <= self.tick { - trace!("triggering; token={:?}", curr); -@@ -280,8 +262,7 @@ impl Timer { - self.unlink(&links, curr); - - // Remove and return the token -- return self.entries.remove(curr) -- .map(|e| e.state); -+ return Some(self.entries.remove(curr.into()).state); - } else { - let next_tick = self.wheel[slot].next_tick; - self.wheel[slot].next_tick = cmp::min(next_tick, links.tick); -@@ -311,11 +292,11 @@ impl Timer { - let slot = self.slot_for(links.tick); - self.wheel[slot].head = links.next; - } else { -- self.entries[links.prev].links.next = links.next; -+ self.entries[links.prev.into()].links.next = links.next; - } - - if links.next != EMPTY { -- self.entries[links.next].links.prev = links.prev; -+ self.entries[links.next.into()].links.prev = links.prev; - - if token == self.next { - self.next = links.next; -@@ -356,7 +337,7 @@ impl Timer { - // Next tick containing a timeout - fn next_tick(&self) -> Option { - if self.next != EMPTY { -- let slot = self.slot_for(self.entries[self.next].links.tick); -+ let slot = self.slot_for(self.entries[self.next.into()].links.tick); - - if self.wheel[slot].next_tick == self.tick { - // There is data ready right now -@@ -497,32 +478,3 @@ impl Entry { - } - } - } -- --impl fmt::Display for TimerError { -- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { -- write!(fmt, "{}: {}", self.kind, self.desc) -- } --} -- --impl TimerError { -- fn overflow() -> TimerError { -- TimerError { -- kind: TimerOverflow, -- desc: "too many timer entries" -- } -- } --} -- --impl error::Error for TimerError { -- fn description(&self) -> &str { -- self.desc -- } --} -- --impl fmt::Display for TimerErrorKind { -- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { -- match *self { -- TimerOverflow => write!(fmt, "TimerOverflow"), -- } -- } --} -diff --git a/test/test_battery.rs b/test/test_battery.rs -index 3976071..d918196 100644 ---- a/test/test_battery.rs -+++ b/test/test_battery.rs -@@ -3,7 +3,7 @@ use mio::*; - use mio::deprecated::{EventLoop, EventLoopBuilder, Handler}; - use mio::net::{TcpListener, TcpStream}; - use std::collections::LinkedList; --use slab; -+use slab::Slab; - use std::{io, thread}; - use std::time::Duration; - -@@ -23,8 +23,6 @@ struct EchoConn { - buf: Vec - } - --type Slab = slab::Slab; -- - impl EchoConn { - fn new(sock: TcpStream) -> EchoConn { - let mut ec = -@@ -81,12 +79,11 @@ impl EchoServer { - - let sock = self.sock.accept().unwrap().0; - let conn = EchoConn::new(sock,); -- let tok = self.conns.insert(conn) -- .ok().expect("could not add connection to slab"); -+ let tok = self.conns.insert(conn); - - // Register the connection -- self.conns[tok].token = Some(tok); -- event_loop.register(&self.conns[tok].sock, tok, Ready::readable(), -+ self.conns[tok].token = Some(Token(tok)); -+ event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()) - .ok().expect("could not register socket with event loop"); - -@@ -106,7 +103,7 @@ impl EchoServer { - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { -- &mut self.conns[tok] -+ &mut self.conns[tok.into()] - } - } - -diff --git a/test/test_echo_server.rs b/test/test_echo_server.rs -index 6d2a84b..c0eda94 100644 ---- a/test/test_echo_server.rs -+++ b/test/test_echo_server.rs -@@ -2,7 +2,7 @@ use {localhost, TryRead, TryWrite}; - use mio::{Events, Poll, PollOpt, Ready, Token}; - use mio::net::{TcpListener, TcpStream}; - use bytes::{Buf, ByteBuf, MutByteBuf, SliceBuf}; --use slab; -+use slab::Slab; - use std::io; - - const SERVER: Token = Token(10_000_000); -@@ -16,8 +16,6 @@ struct EchoConn { - interest: Ready - } - --type Slab = slab::Slab; -- - impl EchoConn { - fn new(sock: TcpStream) -> EchoConn { - EchoConn { -@@ -96,12 +94,11 @@ impl EchoServer { - - let sock = self.sock.accept().unwrap().0; - let conn = EchoConn::new(sock,); -- let tok = self.conns.insert(conn) -- .ok().expect("could not add connection to slab"); -+ let tok = self.conns.insert(conn); - - // Register the connection -- self.conns[tok].token = Some(tok); -- poll.register(&self.conns[tok].sock, tok, Ready::readable(), -+ self.conns[tok].token = Some(Token(tok)); -+ poll.register(&self.conns[tok].sock, Token(tok), Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()) - .ok().expect("could not register socket with event loop"); - -@@ -121,7 +118,7 @@ impl EchoServer { - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { -- &mut self.conns[tok] -+ &mut self.conns[tok.into()] - } - } - -diff --git a/test/test_uds_shutdown.rs b/test/test_uds_shutdown.rs -index 0339c71..58d2431 100644 ---- a/test/test_uds_shutdown.rs -+++ b/test/test_uds_shutdown.rs -@@ -3,7 +3,7 @@ use mio::*; - use mio::deprecated::{EventLoop, Handler}; - use mio::deprecated::unix::*; - use bytes::{Buf, ByteBuf, MutByteBuf, SliceBuf}; --use slab; -+use slab::Slab; - use std::io; - use std::path::PathBuf; - use tempdir::TempDir; -@@ -19,8 +19,6 @@ struct EchoConn { - interest: Ready - } - --type Slab = slab::Slab; -- - impl EchoConn { - fn new(sock: UnixStream) -> EchoConn { - EchoConn { -@@ -101,12 +99,11 @@ impl EchoServer { - - let sock = self.sock.accept().unwrap(); - let conn = EchoConn::new(sock,); -- let tok = self.conns.insert(conn) -- .ok().expect("could not add connection to slab"); -+ let tok = self.conns.insert(conn); - - // Register the connection -- self.conns[tok].token = Some(tok); -- event_loop.register(&self.conns[tok].sock, tok, Ready::readable(), -+ self.conns[tok].token = Some(Token(tok)); -+ event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()) - .ok().expect("could not register socket with event loop"); - -@@ -126,7 +123,7 @@ impl EchoServer { - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { -- &mut self.conns[tok] -+ &mut self.conns[tok.into()] - } - } - -diff --git a/test/test_unix_echo_server.rs b/test/test_unix_echo_server.rs -index ea64815..6f3dd4b 100644 ---- a/test/test_unix_echo_server.rs -+++ b/test/test_unix_echo_server.rs -@@ -3,7 +3,7 @@ use mio::*; - use mio::deprecated::{EventLoop, Handler}; - use mio::deprecated::unix::*; - use bytes::{Buf, ByteBuf, MutByteBuf, SliceBuf}; --use slab; -+use slab::Slab; - use std::path::PathBuf; - use std::io; - use tempdir::TempDir; -@@ -19,8 +19,6 @@ struct EchoConn { - interest: Ready, - } - --type Slab = slab::Slab; -- - impl EchoConn { - fn new(sock: UnixStream) -> EchoConn { - EchoConn { -@@ -96,12 +94,11 @@ impl EchoServer { - - let sock = self.sock.accept().unwrap(); - let conn = EchoConn::new(sock); -- let tok = self.conns.insert(conn) -- .ok().expect("could not add connection to slab"); -+ let tok = self.conns.insert(conn); - - // Register the connection -- self.conns[tok].token = Some(tok); -- event_loop.register(&self.conns[tok].sock, tok, Ready::readable(), PollOpt::edge() | PollOpt::oneshot()) -+ self.conns[tok].token = Some(Token(tok)); -+ event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()) - .ok().expect("could not register socket with event loop"); - - Ok(()) -@@ -118,7 +115,7 @@ impl EchoServer { - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { -- &mut self.conns[tok] -+ &mut self.conns[tok.into()] - } - } - -diff --git a/test/test_unix_pass_fd.rs b/test/test_unix_pass_fd.rs -index b62f56e..f43ec22 100644 ---- a/test/test_unix_pass_fd.rs -+++ b/test/test_unix_pass_fd.rs -@@ -3,7 +3,7 @@ use mio::*; - use mio::deprecated::{EventLoop, Handler}; - use mio::deprecated::unix::*; - use bytes::{Buf, ByteBuf, SliceBuf}; --use slab; -+use slab::Slab; - use std::path::PathBuf; - use std::io::{self, Read}; - use std::os::unix::io::{AsRawFd, FromRawFd}; -@@ -19,8 +19,6 @@ struct EchoConn { - interest: Ready, - } - --type Slab = slab::Slab; -- - impl EchoConn { - fn new(sock: UnixStream) -> EchoConn { - EchoConn { -@@ -107,12 +105,11 @@ impl EchoServer { - - let sock = self.sock.accept().unwrap(); - let conn = EchoConn::new(sock); -- let tok = self.conns.insert(conn) -- .ok().expect("could not add connection to slab"); -+ let tok = self.conns.insert(conn); - - // Register the connection -- self.conns[tok].token = Some(tok); -- event_loop.register(&self.conns[tok].sock, tok, Ready::readable(), PollOpt::edge() | PollOpt::oneshot()) -+ self.conns[tok].token = Some(Token(tok)); -+ event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()) - .ok().expect("could not register socket with event loop"); - - Ok(()) -@@ -129,7 +126,7 @@ impl EchoServer { - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { -- &mut self.conns[tok] -+ &mut self.conns[tok.into()] - } - } - --- -2.15.1 - diff --git a/mio-0.6.12-fix-metadata.diff b/mio-0.6.12-fix-metadata.diff deleted file mode 100644 index 0b249b0..0000000 --- a/mio-0.6.12-fix-metadata.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- mio-0.6.12/Cargo.toml 1970-01-01T01:00:00+01:00 -+++ mio-0.6.12/Cargo.toml 2018-01-12T23:42:45.103287+01:00 -@@ -40,7 +40,7 @@ - version = "0.2.29" - - [dependencies.slab] --version = "0.3.0" -+version = "0.4.0" - [dev-dependencies.bytes] - version = "0.3.0" - -@@ -54,18 +54,5 @@ - [features] - default = ["with-deprecated"] - with-deprecated = [] --[target."cfg(target_os = \"fuchsia\")".dependencies.fuchsia-zircon] --version = "0.3.2" -- --[target."cfg(target_os = \"fuchsia\")".dependencies.fuchsia-zircon-sys] --version = "0.3.2" - [target."cfg(unix)".dependencies.libc] - version = "0.2.19" --[target."cfg(windows)".dependencies.kernel32-sys] --version = "0.2" -- --[target."cfg(windows)".dependencies.miow] --version = "0.2.1" -- --[target."cfg(windows)".dependencies.winapi] --version = "0.2.1" diff --git a/mio-0.6.14-fix-metadata.diff b/mio-0.6.14-fix-metadata.diff new file mode 100644 index 0000000..11a8860 --- /dev/null +++ b/mio-0.6.14-fix-metadata.diff @@ -0,0 +1,21 @@ +--- mio-0.6.14/Cargo.toml 1969-12-31T16:00:00-08:00 ++++ mio-0.6.14/Cargo.toml 2018-03-08T21:17:29.785886-08:00 +@@ -54,18 +54,6 @@ + [features] + default = ["with-deprecated"] + with-deprecated = [] +-[target."cfg(target_os = \"fuchsia\")".dependencies.fuchsia-zircon] +-version = "0.3.2" + +-[target."cfg(target_os = \"fuchsia\")".dependencies.fuchsia-zircon-sys] +-version = "0.3.2" + [target."cfg(unix)".dependencies.libc] + version = "0.2.19" +-[target."cfg(windows)".dependencies.kernel32-sys] +-version = "0.2" +- +-[target."cfg(windows)".dependencies.miow] +-version = "0.2.1" +- +-[target."cfg(windows)".dependencies.winapi] +-version = "0.2.1" diff --git a/rust-mio.spec b/rust-mio.spec index 918bfd7..6f8a8fd 100644 --- a/rust-mio.spec +++ b/rust-mio.spec @@ -6,7 +6,7 @@ %global crate mio Name: rust-%{crate} -Version: 0.6.13 +Version: 0.6.14 Release: 1%{?dist} Summary: Lightweight non-blocking IO @@ -14,12 +14,8 @@ License: MIT URL: https://crates.io/crates/mio Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate # Initial patched metadata -# * No windows -# * No weird OS -# * Bump slab to 0.4, https://github.com/carllerche/mio/pull/768 -Patch0: mio-0.6.12-fix-metadata.diff -# Make it work with slab v0.4 -Patch1: 0001-deps-update-slab-to-0.4.patch +# * No windows or fuchsia +Patch0: mio-0.6.14-fix-metadata.diff ExclusiveArch: %{rust_arches} @@ -28,7 +24,7 @@ BuildRequires: rust-packaging BuildRequires: (crate(iovec) >= 0.1.1 with crate(iovec) < 0.2.0) BuildRequires: (crate(lazycell) >= 0.6.0 with crate(lazycell) < 0.7.0) BuildRequires: (crate(libc) >= 0.2.19 with crate(libc) < 0.3.0) -BuildRequires: (crate(log) >= 0.3.1 with crate(log) < 0.4.0) +BuildRequires: (crate(log) >= 0.4.0 with crate(log) < 0.5.0) BuildRequires: (crate(net2) >= 0.2.29 with crate(net2) < 0.3.0) BuildRequires: (crate(slab) >= 0.4.0 with crate(slab) < 0.5.0) %if %{with check} @@ -73,6 +69,9 @@ which use %{crate} from crates.io. %exclude %{cargo_registry}/%{crate}-%{version}/{appveyor.yml,ci} %changelog +* Fri Mar 09 2018 Josh Stone - 0.6.14-1 +- Update to 0.6.14 + * Wed Feb 07 2018 Josh Stone - 0.6.13-1 - Update to 0.6.13 diff --git a/sources b/sources index d90cff2..0ea7490 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mio-0.6.13.crate) = 6b3ef5964fcf1d7b0a202a9767975746656a517f3c39e1f80bd783058d2786911fac4d99d33ed85d2fee5155bda640fd9cb5f2fe09fee85391f715c4c3eb9729 +SHA512 (mio-0.6.14.crate) = 37b45856d74cd03cdaeb015dfca85065a04175568cda985e59bb0e4b2ca85523d52789d8e9cc2f5336e6a346d2ed50c2bdfe078ed4953613e95ca8d52dd90bb1