[#1094] Fix possible StackOverFlowError when send FileRegions via the AioSocketChannel
This commit is contained in:
parent
71f25d13e2
commit
dc4c4ab6b9
@ -17,6 +17,7 @@ package io.netty.channel.socket.aio;
|
|||||||
|
|
||||||
import io.netty.buffer.BufType;
|
import io.netty.buffer.BufType;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelException;
|
import io.netty.channel.ChannelException;
|
||||||
import io.netty.channel.ChannelFlushPromiseNotifier;
|
import io.netty.channel.ChannelFlushPromiseNotifier;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
@ -535,13 +536,13 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int write(final ByteBuffer src) {
|
public int write(final ByteBuffer src) {
|
||||||
javaChannel().write(src, null, new CompletionHandler<Integer, Object>() {
|
javaChannel().write(src, AioSocketChannel.this, new AioCompletionHandler<Integer, Channel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(Integer result, Object attachment) {
|
public void completed0(Integer result, Channel attachment) {
|
||||||
try {
|
try {
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
javaChannel().write(src, null, this);
|
javaChannel().write(src, AioSocketChannel.this, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (result == -1) {
|
if (result == -1) {
|
||||||
@ -557,7 +558,7 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (src.hasRemaining()) {
|
if (src.hasRemaining()) {
|
||||||
javaChannel().write(src, null, this);
|
javaChannel().write(src, AioSocketChannel.this, this);
|
||||||
} else {
|
} else {
|
||||||
region.transferTo(WritableByteChannelAdapter.this, written);
|
region.transferTo(WritableByteChannelAdapter.this, written);
|
||||||
}
|
}
|
||||||
@ -568,7 +569,7 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed(Throwable exc, Object attachment) {
|
public void failed0(Throwable exc, Channel attachment) {
|
||||||
region.release();
|
region.release();
|
||||||
promise.setFailure(exc);
|
promise.setFailure(exc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user