Minor changes
This commit is contained in:
@@ -228,21 +228,20 @@ final class MQTTConnection {
|
||||
|
||||
void handleConnectionLost() {
|
||||
String clientID = NettyUtils.clientID(channel);
|
||||
if (clientID != null && !clientID.isEmpty()) {
|
||||
LOG.info("Notifying connection lost event. CId = {}, channel: {}", clientID, channel);
|
||||
Session session = sessionRegistry.retrieve(clientID);
|
||||
if (session.hasWill()) {
|
||||
postOffice.fireWill(session.getWill());
|
||||
}
|
||||
if (session.isClean()) {
|
||||
sessionRegistry.remove(clientID);
|
||||
} else {
|
||||
sessionRegistry.disconnect(clientID);
|
||||
}
|
||||
connected = false;
|
||||
if (clientID == null || clientID.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
//?? this breaks test elapseKeepAliveTime
|
||||
// channel.close().addListener(CLOSE_ON_FAILURE);
|
||||
LOG.info("Notifying connection lost event. CId: {}, channel: {}", clientID, channel);
|
||||
Session session = sessionRegistry.retrieve(clientID);
|
||||
if (session.hasWill()) {
|
||||
postOffice.fireWill(session.getWill());
|
||||
}
|
||||
if (session.isClean()) {
|
||||
sessionRegistry.remove(clientID);
|
||||
} else {
|
||||
sessionRegistry.disconnect(clientID);
|
||||
}
|
||||
connected = false;
|
||||
}
|
||||
|
||||
void sendConnAck(boolean isSessionAlreadyPresent) {
|
||||
|
||||
@@ -37,9 +37,7 @@ public class MoquetteIdleTimeoutHandler extends ChannelDuplexHandler {
|
||||
IdleState e = ((IdleStateEvent) evt).state();
|
||||
if (e == IdleState.READER_IDLE) {
|
||||
LOG.info("Firing channel inactive event. MqttClientId = {}.", NettyUtils.clientID(ctx.channel()));
|
||||
// fire a channelInactive to trigger publish of Will
|
||||
//??
|
||||
// ctx.fireChannelInactive();
|
||||
// fire a close that then fire channelInactive to trigger publish of Will
|
||||
ctx.close().addListener(CLOSE_ON_FAILURE);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ServerLowlevelMessagesIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void elapseKeepAliveTime() throws InterruptedException {
|
||||
public void elapseKeepAliveTime() {
|
||||
int keepAlive = 2; // secs
|
||||
|
||||
MqttConnectMessage connectMessage = createConnectMessage("FAKECLNT", keepAlive);
|
||||
|
||||
Reference in New Issue
Block a user