Simplify some error-handling logic a bit.

This commit is contained in:
Benoit Sigoure 2011-02-18 14:29:37 -08:00 committed by kimchy
parent d76f12a9f3
commit fcdd103345
1 changed files with 3 additions and 5 deletions

View File

@ -86,11 +86,10 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
if (buffer.readerIndex() != expectedIndexReader) {
if (buffer.readerIndex() < expectedIndexReader) {
logger.warn("Message not fully read (request) for [{}] and action [{}], resetting", requestId, action);
buffer.readerIndex(expectedIndexReader);
} else {
logger.warn("Message read past expected size (request) for [{}] and action [{}], resetting", requestId, action);
buffer.readerIndex(expectedIndexReader);
}
buffer.readerIndex(expectedIndexReader);
}
} else {
TransportResponseHandler handler = transportServiceAdapter.remove(requestId);
@ -108,11 +107,10 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
if (buffer.readerIndex() != expectedIndexReader) {
if (buffer.readerIndex() < expectedIndexReader) {
logger.warn("Message not fully read (response) for [{}] handler {}, error [{}], resetting", requestId, handler, TransportStreams.statusIsError(status));
buffer.readerIndex(expectedIndexReader);
} else if (buffer.readerIndex() > expectedIndexReader) {
} else {
logger.warn("Message read past expected size (response) for [{}] handler {}, error [{}], resetting", requestId, handler, TransportStreams.statusIsError(status));
buffer.readerIndex(expectedIndexReader);
}
buffer.readerIndex(expectedIndexReader);
}
}
handlesStream.cleanHandles();