I made a bug fix on my Library M2Mqtt (MQTT client) that allows you to better manage the case where the client does not transmit anything for a time equal to the  "keep alive period " and the keep alive thread, whose task is to ping the broker to keep the connection alive, does not receive anything within the timeout period (ex. broker shutdown, network disconnection, ...).

The update is already available on CodePlex and Nuget !