parent
e46ba9e8de
commit
95576d6559
@ -177,7 +177,7 @@ public class ChunkedWriteHandler
|
||||
}
|
||||
currentWrite.fail(cause);
|
||||
} else {
|
||||
currentWrite.promise.setSuccess();
|
||||
currentWrite.success();
|
||||
}
|
||||
closeInput(in);
|
||||
} catch (Exception e) {
|
||||
@ -278,7 +278,8 @@ public class ChunkedWriteHandler
|
||||
@Override
|
||||
public void operationComplete(ChannelFuture future) throws Exception {
|
||||
pendingWrites.decrementAndGet();
|
||||
currentWrite.promise.setSuccess();
|
||||
currentWrite.progress();
|
||||
currentWrite.success();
|
||||
closeInput(chunks);
|
||||
}
|
||||
});
|
||||
@ -354,6 +355,14 @@ public class ChunkedWriteHandler
|
||||
}
|
||||
}
|
||||
|
||||
void success() {
|
||||
if (promise instanceof ChannelProgressivePromise) {
|
||||
// Now we know what the total is.
|
||||
((ChannelProgressivePromise) promise).tryProgress(progress, progress);
|
||||
}
|
||||
promise.setSuccess();
|
||||
}
|
||||
|
||||
void progress() {
|
||||
progress ++;
|
||||
if (promise instanceof ChannelProgressivePromise) {
|
||||
|
@ -187,11 +187,12 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
||||
}
|
||||
}
|
||||
|
||||
in.progress(flushedAmount);
|
||||
|
||||
if (done) {
|
||||
in.remove();
|
||||
} else {
|
||||
// Did not write completely.
|
||||
in.progress(flushedAmount);
|
||||
setOpWrite();
|
||||
break;
|
||||
}
|
||||
@ -215,11 +216,12 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
||||
}
|
||||
}
|
||||
|
||||
in.progress(flushedAmount);
|
||||
|
||||
if (done) {
|
||||
in.remove();
|
||||
} else {
|
||||
// Did not write completely.
|
||||
in.progress(flushedAmount);
|
||||
setOpWrite();
|
||||
break;
|
||||
}
|
||||
|
@ -279,13 +279,15 @@ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty
|
||||
final int readableBytes = buf.writerIndex() - readerIndex;
|
||||
|
||||
if (readableBytes < writtenBytes) {
|
||||
in.progress(readableBytes);
|
||||
in.remove();
|
||||
writtenBytes -= readableBytes;
|
||||
} else if (readableBytes > writtenBytes) {
|
||||
buf.readerIndex(readerIndex + (int) writtenBytes);
|
||||
in.progress(writtenBytes);
|
||||
break;
|
||||
} else { // readable == writtenBytes
|
||||
} else { // readableBytes == writtenBytes
|
||||
in.progress(readableBytes);
|
||||
in.remove();
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user