fix: connection close should stay outside the poll loop (#2308)

This commit is contained in:
Gary Yu
2019-01-07 14:44:07 +08:00
committed by GitHub
parent e79123fd5c
commit 0b73e87f8c
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -291,11 +291,11 @@ fn poll<H>(
.map(|a| a.to_string())
.unwrap_or("?".to_owned())
);
let _ = conn.shutdown(Shutdown::Both);
break;
}
thread::sleep(sleep_time);
}
let _ = conn.shutdown(Shutdown::Both);
});
}
+3 -1
View File
@@ -526,7 +526,9 @@ impl TrackingAdapter {
if known.len() > MAX_TRACK_SIZE {
known.truncate(MAX_TRACK_SIZE);
}
known.insert(0, hash);
if !known.contains(&hash) {
known.insert(0, hash);
}
}
}