Skip to content

Commit

Permalink
Fix changes to channels
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Jan 6, 2015
1 parent 93b14db commit 327075c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "notify"
version = "1.1.0"
version = "1.1.1"
authors = [
"F茅lix Saparelli <me@passcod.name>",
"Antti Ker盲nen <detegr@gmail.com>"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _Cross-platform filesystem notification library for Rust._

```toml
[dependencies]
notify = "1.0"
notify = "1.1"
```

Notify uses semver, so only major versions break backward compatibility. While
Expand Down
9 changes: 5 additions & 4 deletions src/inotify/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
extern crate "inotify" as inotify_sys;
extern crate libc;

use self::inotify_sys::wrapper::{mod, INotify, Watch};
use self::inotify_sys::wrapper::{self, INotify, Watch};
use std::collections::HashMap;
use std::io::IoErrorKind;
use std::sync::{Arc, RWLock};
use std::sync::mpsc::Sender;
use std::thread::Thread;
use super::{Error, Event, op, Op, Watcher};
use std::io::fs::{PathExtensions, walk_dir};
Expand Down Expand Up @@ -35,7 +36,7 @@ impl INotifyWatcher {
match e.kind {
IoErrorKind::EndOfFile => break,
_ => {
let _ = tx.send_opt(Event {
let _ = tx.send(Event {
path: None,
op: Err(Error::Io(e))
});
Expand Down Expand Up @@ -105,10 +106,10 @@ fn handle_event(event: wrapper::Event, tx: &Sender<Event>, paths: &Arc<RWLock<Ha
false => Path::new_opt(event.name)
};

tx.send(Event {
let _ = tx.send(Event {
path: path,
op: Ok(o)
})
});
}

impl Watcher for INotifyWatcher {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#[phase(plugin, link)] extern crate log;

use std::io::IoError;
use std::sync::mpsc::Sender;
#[cfg(test)] use std::sync::mpsc::channel;
pub use self::op::Op;
#[cfg(target_os="linux")]
pub use self::inotify::INotifyWatcher;
Expand Down
15 changes: 8 additions & 7 deletions src/poll.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::{HashMap, HashSet};
use std::io::fs::{mod, PathExtensions};
use std::io::fs::{self, PathExtensions};
use std::sync::{Arc, RWLock};
use std::sync::mpsc::Sender;
use std::thread::Thread;
use super::{Error, Event, op, Watcher};

Expand Down Expand Up @@ -30,7 +31,7 @@ impl PollWatcher {

for watch in watches.read().unwrap().iter() {
if !watch.exists() {
tx.send(Event {
let _ = tx.send(Event {
path: Some(watch.clone()),
op: Err(Error::PathNotFound)
});
Expand All @@ -39,7 +40,7 @@ impl PollWatcher {

match watch.lstat() {
Err(e) => {
tx.send(Event {
let _ = tx.send(Event {
path: Some(watch.clone()),
op: Err(Error::Io(e))
});
Expand All @@ -50,7 +51,7 @@ impl PollWatcher {
None => continue, // First run
Some(old) => {
if stat.modified > old {
tx.send(Event {
let _ = tx.send(Event {
path: Some(watch.clone()),
op: Ok(op::WRITE)
});
Expand All @@ -65,7 +66,7 @@ impl PollWatcher {
// TODO: more efficient implementation where the dir tree is cached?
match fs::walk_dir(watch) {
Err(e) => {
tx.send(Event {
let _ = tx.send(Event {
path: Some(watch.clone()),
op: Err(Error::Io(e))
});
Expand All @@ -75,7 +76,7 @@ impl PollWatcher {
for path in iter {
match path.lstat() {
Err(e) => {
tx.send(Event {
let _ = tx.send(Event {
path: Some(path.clone()),
op: Err(Error::Io(e))
});
Expand All @@ -86,7 +87,7 @@ impl PollWatcher {
None => continue, // First run
Some(old) => {
if stat.modified > old {
tx.send(Event {
let _ = tx.send(Event {
path: Some(path.clone()),
op: Ok(op::WRITE)
});
Expand Down

0 comments on commit 327075c

Please sign in to comment.