Skip to content

Commit

Permalink
Add pingreq handler when active, not when handler is added
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Dec 14, 2021
1 parent 49c60c4 commit 7d343da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/MQTTNIO/ChannelHandlers/MQTTMessageHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ class MQTTMessageHandler: ChannelDuplexHandler {
}

func handlerAdded(context: ChannelHandlerContext) {
if context.channel.isActive {
self.pingreqHandler?.start(context: context)
}
}

func channelActive(context: ChannelHandlerContext) {
self.pingreqHandler?.start(context: context)
}

func handlerRemoved(context: ChannelHandlerContext) {
func channelInactive(context: ChannelHandlerContext) {
self.pingreqHandler?.stop()
}

Expand Down

0 comments on commit 7d343da

Please sign in to comment.