Skip to content

Commit

Permalink
Set current length from remaining length
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Dec 11, 2024
1 parent 8a05601 commit 9a8741a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cpp/controllers/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,11 @@ void Controller::TransferToHost()
assert(!CommandMetaData::Instance().GetCdbMetaData(static_cast<scsi_command>(GetCdb()[0])).has_data_out);

try {
SetCurrentLength(GetDeviceForLun(GetEffectiveLun())->ReadData(GetBuffer()));
ResetOffset();
GetDeviceForLun(GetEffectiveLun())->ReadData(GetBuffer());
if (GetRemainingLength()) {
SetCurrentLength(GetRemainingLength() < GetChunkSize() ? GetRemainingLength() : GetChunkSize());
ResetOffset();
}
}
catch (const scsi_exception &e) {
Error(e.get_sense_key(), e.get_asc());
Expand Down

0 comments on commit 9a8741a

Please sign in to comment.