Skip to content

Commit

Permalink
[core] Not all messages are in a channel
Browse files Browse the repository at this point in the history
we see confirms an errors without a channel designation. 
@makarid I believe you were asking about this
  • Loading branch information
mdvx authored Mar 6, 2020
1 parent 0c5fa85 commit 5d99819
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,14 @@ protected String getChannel(T message) {

protected void handleMessage(T message) {
String channel = getChannel(message);
handleChannelMessage(channel, message);
if (channel != null)
handleChannelMessage(channel, message);
}

protected void handleError(T message, Throwable t) {
String channel = getChannel(message);
handleChannelError(channel, t);
if (channel != null)
handleChannelError(channel, t);
}

protected void handleIdle(ChannelHandlerContext ctx) {
Expand Down

3 comments on commit 5d99819

@makarid
Copy link

@makarid makarid commented on 5d99819 Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So will this fix stop these error messages to pop up to infinity?

@mdvx
Copy link
Owner Author

@mdvx mdvx commented on 5d99819 Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It stop NPEs when getChannelFromMessage returns null (when there is no channel in the message)

like

{"code":"00002","msg":"Connect success"}

@makarid
Copy link

@makarid makarid commented on 5d99819 Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!!! Thanks a lot @mdvx

Please sign in to comment.