Skip to content
Snippets Groups Projects
Verified Commit 11681966 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

BUG: send other chunks in file download

parent 583fc980
Branches
Tags
2 merge requests!44Release 0.6,!43Merge f-GRPC-main to dev
Pipeline #12915 failed
......@@ -37,6 +37,7 @@ public class DownloadBuffer {
final long next_chunk_size = Math.min(unread_bytes, getChunkSize());
final MappedByteBuffer map = fileChannel.map(MapMode.READ_ONLY, position, next_chunk_size);
fileChannel.position(position + next_chunk_size);
final FileChunk.Builder builder = FileChunk.newBuilder();
builder.setData(ByteString.copyFrom(map));
......
......@@ -133,10 +133,14 @@ public class FileTransmissionServiceImpl extends FileTransmissionServiceImplBase
final FileDownloadRequest request,
final StreamObserver<FileDownloadResponse> responseObserver) {
try {
final FileDownloadResponse response =
FileDownloadResponse response =
fileDownloadRegistration.downloadNextChunk(request.getFileTransmissionId());
responseObserver.onNext(response);
while (response.getStatus() == TransmissionStatus.TRANSMISSION_STATUS_GO_ON) {
response = fileDownloadRegistration.downloadNextChunk(request.getFileTransmissionId());
responseObserver.onNext(response);
}
responseObserver.onCompleted();
} catch (final Exception e) {
e.printStackTrace();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment