-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #22] optimize code and codeCov enhancing of protocol.mqtt.handler #63
[ISSUE #22] optimize code and codeCov enhancing of protocol.mqtt.handler #63
Conversation
if (mqttConnectReturnCode == null) { | ||
channelManager.closeConnect(channel, ChannelCloseFrom.SERVER, remark); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the if judgment for #61
channel.writeAndFlush(getMqttConnAckMessage(mqttConnectReturnCode)); | ||
channelManager.closeConnect(channel, ChannelCloseFrom.SERVER, remark); | ||
return; | ||
} | ||
|
||
CompletableFuture<Void> future = new CompletableFuture<>(); | ||
ChannelInfo.setFuture(channel, ChannelInfo.FUTURE_CONNECT, future); | ||
|
||
// use 'scheduler' to separate two i/o: 'ack to client' and 'session-load from rocketmq' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment for 'scheduler'
Codecov Report
@@ Coverage Diff @@
## main #63 +/- ##
==========================================
+ Coverage 23.77% 26.34% +2.56%
==========================================
Files 96 96
Lines 4176 4171 -5
Branches 662 659 -3
==========================================
+ Hits 993 1099 +106
+ Misses 2960 2848 -112
- Partials 223 224 +1
Continue to review full report at Codecov.
|
@Component | ||
public class MqttPubRecHandler implements MqttPacketHandler<MqttMessage> { | ||
private final MqttFixedHeader pubRelMqttFixedHeader = new MqttFixedHeader(MqttMessageType.PUBREL, false, | ||
MqttQoS.AT_LEAST_ONCE, false, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make fixHeader as private field to verify the correct 'qosLevel' in PUBREL header for unit test
|
||
final boolean isQos2Message = isQos2Message(mqttMessage); | ||
if (isQos2Message && !inFlyCache.contains(InFlyCache.CacheType.PUB, channelId, variableHeader.packetId())) { | ||
inFlyCache.put(InFlyCache.CacheType.PUB, channelId, variableHeader.packetId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify the code block
code optimization and codeCov enhancing of mqtt.cs.protocol.mqtt.handler for #22