Avoiding a racing condition.
Avoiding a racing condition.

If the user clicks on a macro button way too fast, the second click
would start being processed before the first one finishes. This can lead
to a racing condition where the socket is disconnected while the other
handler is still using it.

The implemented solution is simple, maybe not the "best", but good
enough: ignore additional clicks while the first one is still being
processed. It required a lot of callbacks, though. And I'm not
completely sure it is bug-free.

There is still a bug somewhere that makes the "permission" window show
up on the TV if a lot of keypresses are being sent in a short time. I
don't know the reason, and the fact that the protocol is not completely
understood does not help.

denilsonsa/crx-ss-tv-remote,denilsonsa/crx-ss-tv-remote,denilsonsa/crx-ss-tv-remote