mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
htc: fixes for WriteFileLarge/sending over data channel
This commit is contained in:
parent
7621bd4e13
commit
f0ef9fb918
3 changed files with 10 additions and 4 deletions
|
@ -429,11 +429,13 @@ namespace ams::htcfs {
|
|||
R_TRY(this->CheckResponseHeader(response, request.packet_type));
|
||||
|
||||
/* Check the response body size. */
|
||||
R_UNLESS(response.body_size > 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
R_UNLESS(response.body_size >= 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
R_UNLESS(static_cast<size_t>(response.body_size) <= MaxPacketBodySize, htcfs::ResultUnexpectedResponseBodySize());
|
||||
|
||||
/* Receive the response body. */
|
||||
R_TRY(this->ReceiveFromRpcChannel(m_packet_buffer, response.body_size));
|
||||
if (response.body_size > 0) {
|
||||
R_TRY(this->ReceiveFromRpcChannel(m_packet_buffer, response.body_size));
|
||||
}
|
||||
|
||||
/* Check that we succeeded. */
|
||||
R_TRY(ConvertHtcfsResult(response.params[0]));
|
||||
|
@ -1332,7 +1334,7 @@ namespace ams::htcfs {
|
|||
m_header_factory.MakeWriteFileLargeHeader(std::addressof(request), handle, option.value, offset, buffer_size, DataChannelId);
|
||||
|
||||
/* Send the request to the host. */
|
||||
R_TRY(this->SendRequest(request, buffer, buffer_size));
|
||||
R_TRY(this->SendRequest(request));
|
||||
|
||||
/* Receive response from the host. */
|
||||
R_TRY(this->ReceiveFromRpcChannel(std::addressof(response), sizeof(response)));
|
||||
|
@ -1537,4 +1539,5 @@ namespace ams::htcfs {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -465,6 +465,9 @@ namespace ams::htclow::mux {
|
|||
|
||||
/* Set max packet size. */
|
||||
m_send_buffer.SetMaxPacketSize(max_packet_size);
|
||||
|
||||
/* Set our total send size. */
|
||||
m_total_send_size = buf_size;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace ams::htclow::mux {
|
|||
|
||||
/* Determine the sendable size. */
|
||||
const auto offset = total_send_size - ring_buffer_data_size;
|
||||
const auto sendable_size = std::min(share - offset, ring_buffer_data_size);
|
||||
const auto sendable_size = m_flow_control_enabled ? std::min(share - offset, ring_buffer_data_size) : ring_buffer_data_size;
|
||||
if (sendable_size == 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue