Skip to content

Commit

Permalink
fix #329 Change the dependency to netty-transport-native-epoll to the…
Browse files Browse the repository at this point in the history
… one with linux-x86_64 classifier

When sending a file from the FS, if NIO is not the chosen transport and the file is
a virtual one (like entry in archive for example) then use the chunked functionality.
  • Loading branch information
violetagg committed Apr 26, 2018
1 parent 59c91be commit e6634c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ configure(rootProject) { project ->
compile "io.netty:netty-handler:${nettyVersion}"
compile "io.netty:netty-handler-proxy:${nettyVersion}"
compile "io.netty:netty-codec-http:${nettyVersion}"
compile "io.netty:netty-transport-native-epoll:${nettyVersion}"
compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
optional "io.netty:netty-transport-native-kqueue:${nettyVersion}"

// Testing
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/reactor/ipc/netty/NettyOutbound.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.DefaultFileRegion;
import io.netty.channel.nio.NioEventLoop;
import io.netty.handler.ssl.SslHandler;
import io.netty.handler.stream.ChunkedInput;
import io.netty.handler.stream.ChunkedNioFile;
Expand Down Expand Up @@ -222,7 +223,9 @@ default NettyOutbound sendFile(Path file) {
*/
default NettyOutbound sendFile(Path file, long position, long count) {
Objects.requireNonNull(file);
if (context().channel().pipeline().get(SslHandler.class) != null) {
if ((context().channel().pipeline().get(SslHandler.class) != null) ||
(!(context().channel().eventLoop() instanceof NioEventLoop) &&
!"file".equals(file.toUri().getScheme()))) {
return sendFileChunked(file, position, count);
}

Expand Down

0 comments on commit e6634c2

Please sign in to comment.