Auto merge of #8660 - pcwalton:ipc-channel-errors, r=larsbergstrom

Update `ipc-channel` to pick up the improved error reporting.

Intended to help diagnose intermittent failures.

r? @jdm or @larsbergstrom (or whoever)

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8660)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-25 07:31:15 +05:30
commit 13a96fcaf7
23 changed files with 84 additions and 78 deletions

View file

@ -30,7 +30,7 @@ git = "https://github.com/servo/rust-layers"
features = ["plugins"]
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"
git = "https://github.com/servo/ipc-channel"
[dependencies.url]
version = "0.2"

View file

@ -8,6 +8,7 @@ use opts;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::io::{Error, ErrorKind};
use std::marker::Reflect;
use std::mem;
use std::sync::Mutex;
@ -27,10 +28,12 @@ pub enum OptionalIpcSender<T> where T: Deserialize + Serialize + Send + Any {
}
impl<T> OptionalIpcSender<T> where T: Deserialize + Serialize + Send + Any {
pub fn send(&self, value: T) -> Result<(), ()> {
pub fn send(&self, value: T) -> Result<(), Error> {
match *self {
OptionalIpcSender::OutOfProcess(ref ipc_sender) => ipc_sender.send(value),
OptionalIpcSender::InProcess(ref sender) => sender.send(value).map_err(|_| ()),
OptionalIpcSender::InProcess(ref sender) => {
sender.send(value).map_err(|_| Error::new(ErrorKind::Other, "MPSC send failed"))
}
}
}