Merge pull request #17182 from s1monw/issues/17090

Provide better error message when an incompatible node connects to a node

We should give a better exception message when an incompatible node connects
and we receive a messeage. This commit adds a clear excpetion based on the
protocol version received instead of throwing cryptic messages about not fully reaed
buffer etc.

Relates to #17090
This commit is contained in:
Simon Willnauer 2016-03-18 10:17:05 +01:00
commit 0fe47f8136
1 changed files with 4 additions and 0 deletions

View File

@ -127,6 +127,10 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
} }
streamIn = compressor.streamInput(streamIn); streamIn = compressor.streamInput(streamIn);
} }
if (version.onOrAfter(Version.CURRENT.minimumCompatibilityVersion()) == false || version.major != Version.CURRENT.major) {
throw new IllegalStateException("Received message from unsupported version: [" + version
+ "] minimal compatible version is: [" +Version.CURRENT.minimumCompatibilityVersion() + "]");
}
streamIn.setVersion(version); streamIn.setVersion(version);
if (TransportStatus.isRequest(status)) { if (TransportStatus.isRequest(status)) {
threadContext.readHeaders(streamIn); threadContext.readHeaders(streamIn);