diff options
author | Shaun Taheri <shaun@advancedtelematic.com> | 2016-06-18 15:36:22 +0200 |
---|---|---|
committer | Shaun Taheri <shaun@advancedtelematic.com> | 2016-06-21 15:33:41 +0200 |
commit | 13a552483b79150d7980823b749fc1d14d3eb1a8 (patch) | |
tree | 1683053366780df2f76b2f05a3af452aab843e36 /src/oauth2.rs | |
parent | 9f56304fc2b3fdbacf5fcea971ee93d61a0d7e32 (diff) | |
download | rvi_sota_client-13a552483b79150d7980823b749fc1d14d3eb1a8.tar.gz |
Propagate shutdown signal to all threads
Diffstat (limited to 'src/oauth2.rs')
-rw-r--r-- | src/oauth2.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/oauth2.rs b/src/oauth2.rs index c9e3c34..2c9ad2a 100644 --- a/src/oauth2.rs +++ b/src/oauth2.rs @@ -13,12 +13,16 @@ pub fn authenticate(config: &AuthConfig, client: &HttpClient) -> Result<AccessTo body: None }); - let resp = try!(resp_rx.recv()); - let data = try!(resp); - let body = try!(String::from_utf8(data)); + match resp_rx.recv() { + Some(resp) => { + let data = try!(resp); + let body = try!(String::from_utf8(data)); + debug!("authenticate, body: `{}`", body); + Ok(try!(json::decode(&body))) + }, - debug!("authenticate, body: `{}`", body); - Ok(try!(json::decode(&body))) + None => panic!("no authenticate response received") + } } |