Skip to content

Commit

Permalink
Context Changes (#6)
Browse files Browse the repository at this point in the history
* context changes

* unpin nightly
  • Loading branch information
dbcfd authored Apr 16, 2019
1 parent 37b8689 commit d5125bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: rust
rust:
- nightly-2019-03-01
- nightly
sudo: false
cache:
- apt
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ edition = "2018"
# When releasing to crates.io:
# - Update doc URL.
# - Create "vX.Y.Z" git tag.
version = "0.4.0"
version = "0.5.0"
license = "MIT"
readme = "README.md"
description = """
Share packets between services using servo ipc
"""
authors = ["Danny Browning <bdbrowning2@gmail.com>"]
categories = ["asynchronous", "network-programming"]
documentation = "https://docs.rs/packet-ipc/0.4.0/packet_ipc/"
documentation = "https://docs.rs/packet-ipc/0.5.0/packet_ipc/"
repository = "https://github.com/dbcfd/packet-ipc"

[dependencies]
bincode = "1"
crossbeam-channel = "0.3"
failure = "0.1"
failure_derive = "0.1"
futures-preview = { version ="0.3.0-alpha.13", features = ["compat"] }
futures-preview = { version ="0.3.0-alpha.14", features = ["compat"] }
ipc-channel = "0.11"
log = "0.4"
serde = { version = "1.0", features = ["derive"] }
Expand Down
13 changes: 6 additions & 7 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use futures::Poll;
use ipc_channel::ipc::{IpcOneShotServer, IpcSender};
use log::*;
use std::pin::Pin;
use std::task::Waker;
use std::task::Context;

pub struct Server {
server: IpcOneShotServer<IpcSender<Option<IpcMessage>>>,
Expand Down Expand Up @@ -40,26 +40,25 @@ pub struct ConnectedIpc {
connection: IpcSender<Option<IpcMessage>>,
}

impl futures::sink::Sink for ConnectedIpc {
type SinkItem = IpcMessage;
impl futures::sink::Sink<IpcMessage> for ConnectedIpc {
type SinkError = Error;

fn poll_ready(self: Pin<&mut Self>, _: &Waker) -> Poll<Result<(), Self::SinkError>> {
fn poll_ready(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
Poll::Ready(Ok(()))
}

fn start_send(self: Pin<&mut Self>, item: Self::SinkItem) -> Result<(), Self::SinkError> {
fn start_send(self: Pin<&mut Self>, item: IpcMessage) -> Result<(), Self::SinkError> {
self.get_mut().connection.send(Some(item)).map_err(|e| {
error!("Failed to send {:?}", e);
Error::Bincode(e)
})
}

fn poll_flush(self: Pin<&mut Self>, _: &Waker) -> Poll<Result<(), Self::SinkError>> {
fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
Poll::Ready(Ok(()))
}

fn poll_close(self: Pin<&mut Self>, _: &Waker) -> Poll<Result<(), Self::SinkError>> {
fn poll_close(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::SinkError>> {
info!("Closing IPC Server");
Poll::Ready(self.get_mut().connection.send(None).map_err(Error::Bincode))
}
Expand Down

0 comments on commit d5125bf

Please # to comment.