Skip to content

Commit

Permalink
fix(rustup): replace sleep with sleep_ms
Browse files Browse the repository at this point in the history
Now it works with the latest compiler. I wonder why I didn't notice
that before ... .
  • Loading branch information
Byron committed Apr 26, 2015
1 parent 2a1247b commit 727c1d8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "yup-oauth2"
version = "0.3.8"
version = "0.3.9"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
repository = "https://github.com/Byron/yup-oauth2"
description = "A partial oauth2 implementation, providing the 'device' authorization flow"
Expand Down
6 changes: 3 additions & 3 deletions examples/auth.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(collections, thread_sleep, std_misc, exit_status)]
#![feature(collections, std_misc, exit_status)]
#![allow(deprecated)]
extern crate yup_oauth2 as oauth2;
extern crate yup_hyper_mock as mock;
Expand All @@ -13,7 +13,7 @@ use getopts::{HasArg,Options,Occur,Fail};
use std::env;
use std::default::Default;
use std::time::Duration;
use std::thread::sleep;
use std::thread::sleep_ms;


fn usage(program: &str, opts: &Options, err: Option<Fail>) {
Expand Down Expand Up @@ -72,7 +72,7 @@ fn main() {
pi.user_code, pi.verification_url, pi.expires_at.with_timezone(&Local));
let delay = Duration::seconds(5);
println!("Browser opens automatically in {} seconds", delay);
sleep(delay);
sleep_ms(delay.num_milliseconds() as u32);
open::that(&pi.verification_url).ok();
println!("DONE - waiting for authorization ...");
}
Expand Down
16 changes: 8 additions & 8 deletions src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::iter::IntoIterator;
use std::borrow::BorrowMut;
use std::collections::HashMap;
use std::hash::{SipHasher, Hash, Hasher};
use std::thread::sleep;
use std::thread::sleep_ms;
use std::cmp::min;
use std::error::Error;
use std::fmt;
Expand Down Expand Up @@ -203,7 +203,7 @@ impl<D, S, C> Authenticator<D, S, C>
RequestError::HttpError(err) => {
match self.delegate.connection_error(&err) {
Retry::Abort|Retry::Skip => return Err(Box::new(StringError::from(&err as &Error))),
Retry::After(d) => sleep(d),
Retry::After(d) => sleep_ms(d.num_milliseconds() as u32),
}
},
RequestError::InvalidClient
Expand Down Expand Up @@ -234,7 +234,7 @@ impl<D, S, C> Authenticator<D, S, C>
match self.delegate.connection_error(err) {
Retry::Abort|Retry::Skip
=> return Err(Box::new(StringError::from(err as &Error))),
Retry::After(d) => sleep(d),
Retry::After(d) => sleep_ms(d.num_milliseconds() as u32),
}
},
&&PollError::Expired(ref t) => {
Expand All @@ -251,7 +251,7 @@ impl<D, S, C> Authenticator<D, S, C>
match self.delegate.pending(&pi) {
Retry::Abort|Retry::Skip
=> return Err(Box::new(StringError::new("Pending authentication aborted".to_string(), None))),
Retry::After(d) => sleep(min(d, pi.interval)),
Retry::After(d) => sleep_ms(min(d, pi.interval).num_milliseconds() as u32),
},
Ok(Some(token)) => return Ok(token)
}
Expand Down Expand Up @@ -301,7 +301,7 @@ impl<D, S, C> GetToken for Authenticator<D, S, C>
return Err(Box::new(StringError::new(
err.description().to_string(),
None))),
Retry::After(d) => sleep(d),
Retry::After(d) => sleep_ms(d.num_milliseconds() as u32),
}
},
RefreshResult::RefreshError(ref err_str, ref err_description) => {
Expand All @@ -322,7 +322,7 @@ impl<D, S, C> GetToken for Authenticator<D, S, C>
Retry::Skip => break,
Retry::Abort => return Err(Box::new(err)),
Retry::After(d) => {
sleep(d);
sleep_ms(d.num_milliseconds() as u32);
continue;
}
}
Expand Down Expand Up @@ -351,7 +351,7 @@ impl<D, S, C> GetToken for Authenticator<D, S, C>
Retry::Skip => break,
Retry::Abort => return Err(Box::new(err)),
Retry::After(d) => {
sleep(d);
sleep_ms(d.num_milliseconds() as u32);
continue;
}
}
Expand All @@ -367,7 +367,7 @@ impl<D, S, C> GetToken for Authenticator<D, S, C>
match self.delegate.token_storage_failure(false, &err) {
Retry::Abort|Retry::Skip => Err(Box::new(err)),
Retry::After(d) => {
sleep(d);
sleep_ms(d.num_milliseconds() as u32);
continue
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(std_misc, thread_sleep)]
#![feature(std_misc)]
#![allow(deprecated)]
//! This library can be used to acquire oauth2.0 authentication for services.
//! At the time of writing, only one way of doing so is implemented, the [device flow](https://developers.google.com/youtube/v3/guides/authentication#devices), along with a flow
Expand Down

0 comments on commit 727c1d8

Please sign in to comment.