Skip to content

Commit 9b1e8ec

Browse files
committed
Merge pull request #75 from jaysonsantos/upgrade-byteorder
Upgrade byteorder to 0.5.1
2 parents f19e3d4 + 5d403b5 commit 9b1e8ec

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ url = "0.5.0"
2424
rustc-serialize = "0.3.16"
2525
bitflags = "0.3.3"
2626
rand = "0.3.12"
27-
byteorder = "0.4.2"
27+
byteorder = "0.5.1"
2828
net2 = "0.2.17"
2929

3030
[features]

src/result.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::fmt;
88
use openssl::ssl::error::SslError;
99
use hyper::Error as HttpError;
1010
use url::ParseError;
11-
use byteorder;
1211

1312
/// The type used for WebSocket results
1413
pub type WebSocketResult<T> = Result<T, WebSocketError>;
@@ -80,6 +79,9 @@ impl Error for WebSocketError {
8079

8180
impl From<io::Error> for WebSocketError {
8281
fn from(err: io::Error) -> WebSocketError {
82+
if err.kind() == io::ErrorKind::UnexpectedEof {
83+
return WebSocketError::NoDataAvailable;
84+
}
8385
WebSocketError::IoError(err)
8486
}
8587
}
@@ -108,15 +110,6 @@ impl From<Utf8Error> for WebSocketError {
108110
}
109111
}
110112

111-
impl From<byteorder::Error> for WebSocketError {
112-
fn from(err: byteorder::Error) -> WebSocketError {
113-
match err {
114-
byteorder::Error::UnexpectedEOF => WebSocketError::NoDataAvailable,
115-
byteorder::Error::Io(err) => From::from(err)
116-
}
117-
}
118-
}
119-
120113
impl From<WSUrlErrorKind> for WebSocketError {
121114
fn from(err: WSUrlErrorKind) -> WebSocketError {
122115
WebSocketError::WebSocketUrlError(err)

0 commit comments

Comments
 (0)