hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Asankha C. Perera" <asan...@apache.org>
Subject Detecting EOF of a Channel when file channels are used [for the IdentityDecoder]
Date Fri, 05 Mar 2010 12:15:32 GMT
Hi All

I seem to have found a possible bug in the IdentityDecoder which checks
for "this.channel.isOpen()" to detect the EOF when using file channels.
However, it seems like although the remote party does close its side of
the socket, that we will not see it unless we read from the channel, as
the "dst.transferFrom(this.channel, position, count)" only returns 0 or
the number of bytes read - and not -1. The attached fix would use the
session input buffer to attempt a read after a zero byte read - and
hopefully will not cause an issue if its a false alarm and there was
data read into the buffer.

If this is indeed a bug, and the attached is a proper fix, I will commit
it to the code with a JIRA


Asankha C. Perera
AdroitLogic, http://adroitlogic.org


View raw message