Skip to content

Commit

Permalink
Handled the close message in UnifiedChannelizer
Browse files Browse the repository at this point in the history
The UnifiedChannelizer was generating a lot of junk validation errors and logging because the close message was removed at 3.5.0 and it was not accounted for here. While the UnifiedChannelizer doesn't do anything particular with the close message it did need to account for it during the messages validation to avoid these errors CTR
  • Loading branch information
spmallette committed Dec 9, 2021
1 parent 9341a43 commit dd859b8
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ protected void channelRead0(final ChannelHandlerContext ctx, final RequestMessag
}

protected void validateRequest(final RequestMessage message, final GraphManager graphManager) throws SessionException {
if (!message.optionalArgs(Tokens.ARGS_GREMLIN).isPresent()) {
final String msg = String.format("A message with an [%s] op code requires a [%s] argument.", message.getOp(), Tokens.ARGS_GREMLIN);
// close message just needs to be accounted for here as of 3.5.2. it will not contain a "gremlin" arg. unified
// channelizer basically ignores the close message otherwise
if (!message.getOp().equals(Tokens.OPS_CLOSE) && !message.optionalArgs(Tokens.ARGS_GREMLIN).isPresent()) {
final String msg = String.format("A message with a [%s] op code requires a [%s] argument.", message.getOp(), Tokens.ARGS_GREMLIN);
throw new SessionException(msg, ResponseMessage.build(message).code(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS).statusMessage(msg).create());
}

Expand Down

0 comments on commit dd859b8

Please sign in to comment.