Skip to content

Commit

Permalink
Fix race in ChannelReadHandler used during LocalChannel testing. (net…
Browse files Browse the repository at this point in the history
…ty#7904)

Motivation:

ChannelReadHandler is used in tests added via f4d7e8d. In the handler we verify the number of messages we receive per read() call but missed to sometimes reset the counter which resulted in exceptions.

Modifications:

Correctly reset read counter in all cases.

Result:

No more unexpected exceptions when running LocalChannel tests.
  • Loading branch information
normanmaurer authored May 4, 2018
1 parent c60263e commit 095dadc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1190,8 +1190,16 @@ public void run() {
} else {
read = 0;
}
} else {
read = 0;
}
ctx.fireChannelReadComplete();
}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
ctx.fireExceptionCaught(cause);
ctx.close();
}
}
}

0 comments on commit 095dadc

Please sign in to comment.