@@ -21,7 +21,7 @@ pub(super) struct Pool<T> {
21
21
//
22
22
// See https://github.com/hyperium/hyper/issues/1429
23
23
pub ( super ) trait Poolable : Sized {
24
- fn is_closed ( & self ) -> bool ;
24
+ fn is_open ( & self ) -> bool ;
25
25
/// Reserve this connection.
26
26
///
27
27
/// Allows for HTTP/2 to return a shared reservation.
@@ -236,7 +236,7 @@ impl<'a, T: Poolable + 'a> IdlePopper<'a, T> {
236
236
while let Some ( entry) = self . list . pop ( ) {
237
237
// If the connection has been closed, or is older than our idle
238
238
// timeout, simply drop it and keep looking...
239
- if entry. value . is_closed ( ) {
239
+ if ! entry. value . is_open ( ) {
240
240
trace ! ( "removing closed connection for {:?}" , self . key) ;
241
241
continue ;
242
242
}
@@ -377,7 +377,7 @@ impl<T: Poolable> PoolInner<T> {
377
377
378
378
self . idle . retain ( |key, values| {
379
379
values. retain ( |entry| {
380
- if entry. value . is_closed ( ) {
380
+ if ! entry. value . is_open ( ) {
381
381
trace ! ( "idle interval evicting closed for {:?}" , key) ;
382
382
return false ;
383
383
}
@@ -475,7 +475,7 @@ impl<T: Poolable> DerefMut for Pooled<T> {
475
475
impl < T : Poolable > Drop for Pooled < T > {
476
476
fn drop ( & mut self ) {
477
477
if let Some ( value) = self . value . take ( ) {
478
- if value. is_closed ( ) {
478
+ if ! value. is_open ( ) {
479
479
// If we *already* know the connection is done here,
480
480
// it shouldn't be re-inserted back into the pool.
481
481
return ;
@@ -519,7 +519,7 @@ impl<T: Poolable> Checkout<T> {
519
519
if let Some ( mut rx) = self . waiter . take ( ) {
520
520
match rx. poll ( ) {
521
521
Ok ( Async :: Ready ( value) ) => {
522
- if ! value. is_closed ( ) {
522
+ if value. is_open ( ) {
523
523
Ok ( Async :: Ready ( Some ( self . pool . reuse ( & self . key , value) ) ) )
524
524
} else {
525
525
Err ( :: Error :: new_canceled ( Some ( CANCELED ) ) )
@@ -662,30 +662,15 @@ mod tests {
662
662
struct Uniq < T > ( T ) ;
663
663
664
664
impl < T > Poolable for Uniq < T > {
665
- fn is_closed ( & self ) -> bool {
666
- false
665
+ fn is_open ( & self ) -> bool {
666
+ true
667
667
}
668
668
669
669
fn reserve ( self ) -> Reservation < Self > {
670
670
Reservation :: Unique ( self )
671
671
}
672
672
}
673
673
674
- /*
675
- #[derive(Debug, PartialEq, Eq, Clone, Copy)]
676
- struct Share<T>(T);
677
-
678
- impl<T> Poolable for Share<T> {
679
- fn is_closed(&self) -> bool {
680
- false
681
- }
682
-
683
- fn reserve(self) -> Reservation<Self> {
684
- Reservation::Shared(self.clone(), self)
685
- }
686
- }
687
- */
688
-
689
674
fn c < T : Poolable > ( key : Key ) -> Connecting < T > {
690
675
Connecting {
691
676
key,
@@ -817,8 +802,8 @@ mod tests {
817
802
}
818
803
819
804
impl Poolable for CanClose {
820
- fn is_closed ( & self ) -> bool {
821
- self . closed
805
+ fn is_open ( & self ) -> bool {
806
+ ! self . closed
822
807
}
823
808
824
809
fn reserve ( self ) -> Reservation < Self > {
0 commit comments