Note: The first 2 tests are needed - to NOT need a resync, the current device must already be the selected "best" device from the gateway group (new device), AND it must not be the device that has just gone down/up. (e.g. if the current device is the new (best) device, but that device has just come up, then we need to resync OpenVPN anyway. It needs to start listening (server) or making outbound connect attempts (client) from scratch again. And old version of the OpenVPN instance may or may not be running and may or may not recover in this instance.
The 3rd comparison is redundant, when current_device == new_device then the 2nd and 3rd tests are effectively the same. I had put it in originally, and left it there for "clarity" - if the new device is the device that just came up then we certainly want to resync OpenVPN. Maybe the "clarity" is confusion for readers who notice that the 3rd test is redundant.