mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +01:00
Merge branch 'remove-error-sender' into 'master'
Remove Error::Sender It was dead code See merge request !2
This commit is contained in:
@@ -21,10 +21,6 @@ pub enum Error {
|
|||||||
Serialize(bincode::serde::SerializeError),
|
Serialize(bincode::serde::SerializeError),
|
||||||
/// An error in deserialization
|
/// An error in deserialization
|
||||||
Deserialize(bincode::serde::DeserializeError),
|
Deserialize(bincode::serde::DeserializeError),
|
||||||
/// An internal message failed to send.
|
|
||||||
/// Channels are used for the client's inter-thread communication. This message is
|
|
||||||
/// propagated if the receiver unexpectedly hangs up.
|
|
||||||
Sender,
|
|
||||||
/// An internal message failed to be received.
|
/// An internal message failed to be received.
|
||||||
/// Channels are used for the client's inter-thread communication. This message is
|
/// Channels are used for the client's inter-thread communication. This message is
|
||||||
/// propagated if the sender unexpectedly hangs up.
|
/// propagated if the sender unexpectedly hangs up.
|
||||||
@@ -57,12 +53,6 @@ impl convert::From<io::Error> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> convert::From<sync::mpsc::SendError<T>> for Error {
|
|
||||||
fn from(_: sync::mpsc::SendError<T>) -> Error {
|
|
||||||
Error::Sender
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl convert::From<sync::mpsc::RecvError> for Error {
|
impl convert::From<sync::mpsc::RecvError> for Error {
|
||||||
fn from(_: sync::mpsc::RecvError) -> Error {
|
fn from(_: sync::mpsc::RecvError) -> Error {
|
||||||
Error::Receiver
|
Error::Receiver
|
||||||
@@ -140,10 +130,7 @@ impl ConnectionHandler {
|
|||||||
trace!("ConnectionHandler: serving client...");
|
trace!("ConnectionHandler: serving client...");
|
||||||
loop {
|
loop {
|
||||||
match self.read() {
|
match self.read() {
|
||||||
Ok(Packet {
|
Ok(Packet { rpc_id, message, }) => {
|
||||||
rpc_id: id,
|
|
||||||
message: message
|
|
||||||
}) => {
|
|
||||||
let f = f.clone();
|
let f = f.clone();
|
||||||
let inflight_rpcs = self.inflight_rpcs.clone();
|
let inflight_rpcs = self.inflight_rpcs.clone();
|
||||||
inflight_rpcs.increment();
|
inflight_rpcs.increment();
|
||||||
@@ -151,7 +138,7 @@ impl ConnectionHandler {
|
|||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let reply = f.serve(message);
|
let reply = f.serve(message);
|
||||||
let reply_packet = Packet {
|
let reply_packet = Packet {
|
||||||
rpc_id: id,
|
rpc_id: rpc_id,
|
||||||
message: reply
|
message: reply
|
||||||
};
|
};
|
||||||
let mut stream = stream.lock().unwrap();
|
let mut stream = stream.lock().unwrap();
|
||||||
@@ -280,7 +267,7 @@ pub fn serve_async<A, F>(addr: A, f: F, read_timeout: Option<Duration>) -> io::R
|
|||||||
};
|
};
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
if let Err(err) = handler.handle_conn(f) {
|
if let Err(err) = handler.handle_conn(f) {
|
||||||
error!("ConnectionHandler: error in connection handling: {:?}", err);
|
info!("ConnectionHandler: err in connection handling: {:?}", err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user