Guys you don't reset `p.lastReceivedTime` variable while reconnect so that's cause infinite reconnecting loop.