Skip to content

Commit

Permalink
Register telnet callbacks only once (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
ol-iver authored Oct 7, 2024
1 parent 5320aad commit 7cf2ec4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions denonavr/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ def register_callback(

if event not in self._callbacks.keys():
self._callbacks[event] = []
elif callback in self._callbacks[event]:
return
self._callbacks[event].append(callback)

def unregister_callback(
Expand All @@ -618,6 +620,8 @@ def _register_raw_callback(
self, callback: Callable[[str], Awaitable[None]]
) -> None:
"""Register a callback handler for raw telnet messages."""
if callback in self._raw_callbacks:
return
self._raw_callbacks.append(callback)

def _unregister_raw_callback(
Expand Down

0 comments on commit 7cf2ec4

Please sign in to comment.