Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/REPCommandPacker.java @ 267:c513cf1ce9cc
call handle.cancel() on socket channel close.
fix unterminated read() on closed channel.
on socket channel close, key.isreadable() and read() will return -1
we should throw IOException in this case.
author | kono |
---|---|
date | Thu, 11 Sep 2008 14:39:32 +0900 |
parents | 526ee0354067 |
children | 5b7abc22e61a |
line wrap: on
line diff
--- a/rep/REPCommandPacker.java Thu Sep 11 14:18:22 2008 +0900 +++ b/rep/REPCommandPacker.java Thu Sep 11 14:39:32 2008 +0900 @@ -89,7 +89,7 @@ throw new IOException(); } 下のwhileループで OK ? */ while(header.remaining()>0){ - sc.read(header); + if (sc.read(header)<0) throw new IOException(); } // 壊れたパケットに対してはブロックする可能性あり まぁTCPだしいいか? header.rewind(); // position = 0 @@ -112,7 +112,7 @@ throw new IOException(); }*/ while(textBuffer.remaining()>0){ - sc.read(textBuffer); + if (sc.read(textBuffer)<0) throw new IOException(); } textBuffer.rewind();