Correctly return StatusWords from transfer_data

This commit is contained in:
Jack Grigg
2019-12-01 22:02:39 +00:00
parent 7bcd8664a4
commit 370a90f800
+4 -4
View File
@@ -375,7 +375,7 @@ impl<'tx> Transaction<'tx> {
) -> Result<Response, Error> { ) -> Result<Response, Error> {
let mut in_offset = 0; let mut in_offset = 0;
let mut out_data = vec![]; let mut out_data = vec![];
let mut sw = 0; let mut sw;
loop { loop {
let mut this_size = 0xff; let mut this_size = 0xff;
@@ -395,13 +395,13 @@ impl<'tx> Transaction<'tx> {
.data(&in_data[in_offset..(in_offset + this_size)]) .data(&in_data[in_offset..(in_offset + this_size)])
.transmit(self, 261)?; .transmit(self, 261)?;
if !response.is_success() && (response.status_words().code() >> 8 != 0x61) { sw = response.status_words().code();
if !response.is_success() && (sw >> 8 != 0x61) {
// TODO(tarcieri): is this really OK? // TODO(tarcieri): is this really OK?
return Ok(Response::new(sw.into(), out_data)); return Ok(Response::new(sw.into(), out_data));
} }
sw = response.status_words().code();
if !out_data.is_empty() && (out_data.len() - response.data().len() > max_out) { if !out_data.is_empty() && (out_data.len() - response.data().len() > max_out) {
error!( error!(
"output buffer too small: wanted to write {}, max was {}", "output buffer too small: wanted to write {}, max was {}",