提交 bd854040 编写于 作者: R rriggs

8185719: rmi TestSocketFactory does not flush

Reviewed-by: lancea, dfuchs
上级 15c887e7
......@@ -512,9 +512,8 @@ public class TestSocketFactory extends RMISocketFactory
} else {
if (matchIndex > 0) {
// mismatch, write out any that matched already
if (matchIndex > 0) // Only non-trivial matches
DEBUG( "Partial match %s matched %d bytes at offset: %d (0x%04x), expected: x%02x, actual: x%02x%n",
name, matchIndex, bytesOut, bytesOut, matchBytes[matchIndex], b);
DEBUG("Partial match %s matched %d bytes at offset: %d (0x%04x), expected: x%02x, actual: x%02x%n",
name, matchIndex, bytesOut, bytesOut, matchBytes[matchIndex], b);
out.write(matchBytes, 0, matchIndex);
log.write(matchBytes, 0, matchIndex);
bytesOut += matchIndex;
......@@ -530,6 +529,19 @@ public class TestSocketFactory extends RMISocketFactory
}
}
public void flush() throws IOException {
if (matchIndex > 0) {
// write out any that matched already to avoid consumer hang.
// Match/replace across a flush is not supported.
DEBUG( "Flush partial match %s matched %d bytes at offset: %d (0x%04x)%n",
name, matchIndex, bytesOut, bytesOut);
out.write(matchBytes, 0, matchIndex);
log.write(matchBytes, 0, matchIndex);
bytesOut += matchIndex;
matchIndex = 0;
}
}
@Override
public String toString() {
return String.format("%s: Out: (%d)", name, bytesOut);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册