Do not reuse next ptr for multiple linked lists

Because, you might think that each linked list has exclusive access to
the next pointer, but then there is an edge case that proves otherwise.
Also, debugging this kind of thing is annoying.
This commit is contained in:
Carl Lerche
2017-08-23 20:35:53 -07:00
parent 7e8c7fd2b8
commit 66dbde92ef
7 changed files with 101 additions and 42 deletions

View File

@@ -33,9 +33,7 @@ pub fn main() {
let connection = Server::handshake(socket)
.then(|res| {
let conn = res.unwrap();
.and_then(|conn| {
println!("H2 connection bound");
conn.for_each(|(request, mut stream)| {
@@ -45,12 +43,14 @@ pub fn main() {
.status(status::OK)
.body(()).unwrap();
if let Err(e) = stream.send_response(response, true) {
if let Err(e) = stream.send_response(response, false) {
println!(" error responding; err={:?}", e);
}
println!(">>>> sending data");
stream.send_data(Bytes::from_static(b"hello world"), true).unwrap();
if let Err(e) = stream.send_data(Bytes::from_static(b"hello world"), true) {
println!(" -> err={:?}", e);
}
Ok(())
}).and_then(|_| {
@@ -59,7 +59,10 @@ pub fn main() {
})
})
.then(|res| {
let _ = res.unwrap();
if let Err(e) = res {
println!(" -> err={:?}", e);
}
Ok(())
})
;