Skip to content

Commit e4c72ed

Browse files
committed
Propagate error also in the reader, not just in waiting threads
1 parent add53eb commit e4c72ed

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl ClientType {
111111
}
112112

113113
impl Client {
114-
/// Default constructor supporting multiple backend by providing a prefix
114+
/// Default constructor supporting multiple backends by providing a prefix
115115
///
116116
/// Supported prefixes are:
117117
/// - tcp:// for a TCP plaintext client.

src/raw_client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ impl<S: Read + Write> RawClient<S> {
404404
s.send(ChannelMessage::Error(error.clone()))
405405
.expect("Unable to send ChannelMessage::Error");
406406
}
407+
return Err(Error::SharedIOError(error.clone()));
407408
}
408409
trace!("<== {}", raw_resp);
409410

@@ -535,7 +536,7 @@ impl<S: Read + Write> RawClient<S> {
535536
Ok(ChannelMessage::Error(e)) => {
536537
warn!("Received ChannelMessage::Error");
537538

538-
break Err(Error::ChannelError(e));
539+
break Err(Error::SharedIOError(e));
539540
}
540541
e @ Err(_) => e.map(|_| ()).expect("Error receiving from channel"), // panic if there's something wrong with the channels
541542
}

src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ pub enum Error {
291291
SSLOverSocks5,
292292
/// Made one or multiple attempts, always in Error
293293
AllAttemptsErrored(Vec<Error>),
294-
/// There was an error transmitted from the reader thread to others
295-
ChannelError(Arc<std::io::Error>),
294+
/// There was an io error reading the socket, to be shared between threads
295+
SharedIOError(Arc<std::io::Error>),
296296
/// Setting both a proxy and a timeout in `Config` results in this error
297297
BothSocksAndTimeout,
298298
/// Setting both a timeout and passing zero or more than one socket addrs is an error

0 commit comments

Comments
 (0)