Fix missing recycle in recv_from (#1205)

In the error case that i>0 (we have blobs to send)
we break out of the loop and do not push the allocated r
to the v array. We should recycle this blob, otherwise it
will be dropped.
This commit is contained in:
sakridge 2018-09-13 08:29:18 -07:00 committed by GitHub
parent ee74b367ce
commit 1a4cd763f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -468,13 +468,14 @@ impl Blob {
match Blob::recv_blob(socket, &r) { match Blob::recv_blob(socket, &r) {
Err(_) if i > 0 => { Err(_) if i > 0 => {
trace!("got {:?} messages on {}", i, socket.local_addr().unwrap()); trace!("got {:?} messages on {}", i, socket.local_addr().unwrap());
re.recycle(r, "Bob::recv_from::i>0");
break; break;
} }
Err(e) => { Err(e) => {
if e.kind() != io::ErrorKind::WouldBlock { if e.kind() != io::ErrorKind::WouldBlock {
info!("recv_from err {:?}", e); info!("recv_from err {:?}", e);
} }
re.recycle(r, "Blob::recv_from"); re.recycle(r, "Blob::recv_from::empty");
return Err(Error::IO(e)); return Err(Error::IO(e));
} }
Ok(()) => if i == 0 { Ok(()) => if i == 0 {