Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit43cff3a

Browse files
odiszapcslandelle
authored andcommitted
Update progress during upload large bodies,closeAsyncHttpClient#728
Motivation:`BodyChunkedInput` does not update progress member, it always stays zero.Thus `ProgressAsyncHandler#onContentWriteProgress` receives zeroes in amount and current parameters. Users sees data is being sent but has no information about exact amount of data has been written to channel.Modifications:`BodyChunkedInput` was modified to update progress.`WriteProgressListener` was modified to ignore zero progress. It happens due to non-blocking nature of network writes. We just ignore callbacks when there was no progress at all.Result:Progress is updated each time bytes are phisically written to channel.Callbacks are triggered with actual amount of data written.
1 parent79016a7 commit43cff3a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

‎client/src/main/java/org/asynchttpclient/netty/request/WriteProgressListener.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ public void operationProgressed(ChannelProgressiveFuture f, long progress, long
4545
if (total <0) {
4646
total =expectedTotal;
4747
}
48-
progressAsyncHandler.onContentWriteProgress(progress -lastLastProgress,progress,total);
48+
if (progress !=lastLastProgress) {
49+
progressAsyncHandler.onContentWriteProgress(progress -lastLastProgress,progress,total);
50+
}
4951
}
5052
}
5153
}

‎client/src/main/java/org/asynchttpclient/netty/request/body/BodyChunkedInput.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public ByteBuf readChunk(ByteBufAllocator alloc) throws Exception {
5757

5858
ByteBufbuffer =alloc.buffer(chunkSize);
5959
Body.BodyStatestate =body.transferTo(buffer);
60+
progress +=buffer.writerIndex();
6061
switch (state) {
6162
caseSTOP:
6263
endOfInput =true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp