Skip to content

Commit 604ebfb

Browse files
committed
perf(client): reduce an allocation per http2 connection
1 parent f44fa0e commit 604ebfb

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tokio-executor = { version = "0.1.0", optional = true }
3737
tokio-io = "0.1"
3838
tokio-reactor = { version = "0.1", optional = true }
3939
tokio-tcp = { version = "0.1", optional = true }
40-
want = "0.0.3"
40+
want = "0.0.4"
4141

4242
[dev-dependencies]
4343
num_cpus = "1.0"

src/client/dispatch.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::sync::Arc;
2-
31
use futures::{Async, Poll, Stream};
42
use futures::sync::{mpsc, oneshot};
53
use want;
@@ -47,8 +45,8 @@ pub struct Sender<T, U> {
4745
/// Cannot poll the Giver, but can still use it to determine if the Receiver
4846
/// has been dropped. However, this version can be cloned.
4947
pub struct UnboundedSender<T, U> {
50-
// Only used for `is_closed`, since mpsc::UnboundedSender cannot be checked.
51-
giver: Arc<want::Giver>,
48+
/// Only used for `is_closed`, since mpsc::UnboundedSender cannot be checked.
49+
giver: want::SharedGiver,
5250
inner: mpsc::UnboundedSender<Envelope<T, U>>,
5351
}
5452

@@ -101,7 +99,7 @@ impl<T, U> Sender<T, U> {
10199

102100
pub fn unbound(self) -> UnboundedSender<T, U> {
103101
UnboundedSender {
104-
giver: Arc::new(self.giver),
102+
giver: self.giver.shared(),
105103
inner: self.inner,
106104
}
107105
}

0 commit comments

Comments
 (0)