From the error, I figured not everything was sent when I called request_response.send_response()
.
To fix this I had to set the max request size and response size when defining the request_reponse Behaviour
so it can accept and send larger files.
let codec = cbor::codec::Codec::default()
.set_request_size_maximum(u64::MAX) // specify max file size
.set_response_size_maximum(u64::MAX);
let request_response = request_response::cbor::Behaviour::with_codec(
codec,
[(
StreamProtocol::new("/file-exchange/1"),
ProtocolSupport::Full,
)],
request_response::Config::default(),
);