diff --git a/RELEASES.md b/RELEASES.md index 536aaa8..eb5a9fa 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,52 @@ +## 0.21.1 (2020-08-02) + +### New Features + +#### #[tarpc::server] diagnostics + +When a service impl uses #[tarpc::server], only `async fn`s are re-written. This can lead to +confusing compiler errors about missing associated types: + +``` +error: not all trait items implemented, missing: `HelloFut` + --> $DIR/tarpc_server_missing_async.rs:9:1 + | +9 | impl World for HelloServer { + | ^^^^ +``` + +The proc macro now provides better diagnostics for this case: + +``` +error: not all trait items implemented, missing: `HelloFut` + --> $DIR/tarpc_server_missing_async.rs:9:1 + | +9 | impl World for HelloServer { + | ^^^^ + +error: hint: `#[tarpc::server]` only rewrites async fns, and `fn hello` is not async + --> $DIR/tarpc_server_missing_async.rs:10:5 + | +10 | fn hello(name: String) -> String { + | ^^ +``` + +### Bug Fixes + +#### Fixed client hanging when server shuts down + +Previously, clients would ignore when the read half of the transport was closed, continuing to +write requests. This didn't make much sense, because without the ability to receive responses, +clients have no way to know if requests were actually processed by the server. It basically just +led to clients that would hang for a few seconds before shutting down. This has now been +corrected: clients will immediately shut down when the read-half of the transport is closed. + +#### More docs.rs documentation + +Previously, docs.rs only documented items enabled by default, notably leaving out documentation +for tokio and serde features. This has now been corrected: docs.rs should have documentation +for all optional features. + ## 0.21.0 (2020-06-26) ### New Features diff --git a/example-service/src/client.rs b/example-service/src/client.rs index f9c37bb..65294ae 100644 --- a/example-service/src/client.rs +++ b/example-service/src/client.rs @@ -11,6 +11,8 @@ use tokio_serde::formats::Json; #[tokio::main] async fn main() -> io::Result<()> { + env_logger::init(); + let flags = App::new("Hello Client") .version("0.1") .author("Tim ") diff --git a/tarpc/Cargo.toml b/tarpc/Cargo.toml index 8b0da93..201f4df 100644 --- a/tarpc/Cargo.toml +++ b/tarpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tarpc" -version = "0.21.0" +version = "0.21.1" authors = ["Adam Wright ", "Tim Kuehn "] edition = "2018" license = "MIT" diff --git a/tarpc/src/rpc/server/mod.rs b/tarpc/src/rpc/server/mod.rs index 0481052..d3fd59f 100644 --- a/tarpc/src/rpc/server/mod.rs +++ b/tarpc/src/rpc/server/mod.rs @@ -20,7 +20,7 @@ use futures::{ task::*, }; use humantime::format_rfc3339; -use log::{debug, info, trace}; +use log::{debug, trace}; use pin_project::pin_project; use std::{fmt, hash::Hash, io, marker::PhantomData, pin::Pin, time::SystemTime}; use tokio::time::Timeout; @@ -664,8 +664,8 @@ where tokio::spawn(request_handler); Ok(()) }) - .map_ok(|()| info!("ClientHandler finished.")) - .unwrap_or_else(|e| info!("ClientHandler errored out: {}", e)) + .map_ok(|()| log::info!("ClientHandler finished.")) + .unwrap_or_else(|e| log::info!("ClientHandler errored out: {}", e)) } } @@ -701,7 +701,7 @@ where .execute(), ); } - info!("Server shutting down."); + log::info!("Server shutting down."); Poll::Ready(()) } }