|
|
@ -175,13 +175,7 @@ public class DirectoryBrowser {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RandomAccessFile raf;
|
|
|
|
long fileLength = file.length();
|
|
|
|
try {
|
|
|
|
|
|
|
|
raf = new RandomAccessFile(file, "r");
|
|
|
|
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
long fileLength = raf.length();
|
|
|
|
|
|
|
|
if (fileLength < MIN_NETTY_DIRECT_SEND_SIZE){
|
|
|
|
if (fileLength < MIN_NETTY_DIRECT_SEND_SIZE){
|
|
|
|
FileInputStream fileInputStream = new FileInputStream(file);
|
|
|
|
FileInputStream fileInputStream = new FileInputStream(file);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -210,6 +204,7 @@ public class DirectoryBrowser {
|
|
|
|
// Write the content.
|
|
|
|
// Write the content.
|
|
|
|
ChannelFuture sendFileFuture;
|
|
|
|
ChannelFuture sendFileFuture;
|
|
|
|
ChannelFuture lastContentFuture;
|
|
|
|
ChannelFuture lastContentFuture;
|
|
|
|
|
|
|
|
RandomAccessFile raf = new RandomAccessFile(file, "r"); // will closed by netty
|
|
|
|
if (ctx.pipeline().get(SslHandler.class) == null) {
|
|
|
|
if (ctx.pipeline().get(SslHandler.class) == null) {
|
|
|
|
sendFileFuture =
|
|
|
|
sendFileFuture =
|
|
|
|
ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise());
|
|
|
|
ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise());
|
|
|
|