Fixes a failure to detect end-of-stream/socket closed condition.
De-registers channels from the selector when they time-out.
This commit is contained in:
parent
e273e24ee6
commit
004d962d71
@ -966,7 +966,16 @@ public class MultiplexingTcpHostHarvester
|
||||
{
|
||||
i.remove();
|
||||
logger.info("Read timeout for socket: "
|
||||
+ channelDesc.channel);
|
||||
+ channelDesc.channel.socket());
|
||||
|
||||
// De-register from the selector
|
||||
for (SelectionKey key : readSelector.keys())
|
||||
{
|
||||
if (key.channel().equals(channelDesc.channel))
|
||||
{
|
||||
key.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@ -1156,7 +1165,10 @@ public class MultiplexingTcpHostHarvester
|
||||
|
||||
try
|
||||
{
|
||||
channel.channel.read(channel.buffer);
|
||||
if (channel.channel.read(channel.buffer) == -1)
|
||||
{
|
||||
throw new IOException("Socket closed.");
|
||||
}
|
||||
|
||||
if (!channel.buffer.hasRemaining())
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user