From 63918ac3f3864ec315b1b0be63d5eb54e8fb750c Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Wed, 25 May 2011 20:52:54 +0200 Subject: [PATCH] Log a warning if MPD tries to communicate with dead actors. --- mopidy/frontends/mpd/dispatcher.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mopidy/frontends/mpd/dispatcher.py b/mopidy/frontends/mpd/dispatcher.py index f5c30b23..a72789f1 100644 --- a/mopidy/frontends/mpd/dispatcher.py +++ b/mopidy/frontends/mpd/dispatcher.py @@ -1,10 +1,12 @@ +import logging import re +from pykka import ActorDeadError from pykka.registry import ActorRegistry from mopidy.backends.base import Backend from mopidy.frontends.mpd.exceptions import (MpdAckError, MpdArgError, - MpdUnknownCommand) + MpdUnknownCommand, MpdSystemError) from mopidy.frontends.mpd.protocol import mpd_commands, request_handlers # Do not remove the following import. The protocol modules must be imported to # get them registered as request handlers. @@ -16,6 +18,8 @@ from mopidy.frontends.mpd.protocol import (audio_output, command_list, from mopidy.mixers.base import BaseMixer from mopidy.utils import flatten +logger = logging.getLogger('mopidy.frontends.mpd.dispatcher') + class MpdDispatcher(object): """ The MPD session feeds the MPD dispatcher with requests. The dispatcher @@ -49,6 +53,10 @@ class MpdDispatcher(object): if command_list_index is not None: e.index = command_list_index return self.handle_response(e.get_mpd_ack(), add_ok=False) + except ActorDeadError as e: + logger.warning(u'Tried to communicate with dead actor.') + mpd_error = MpdSystemError(e.message) + return self.handle_response(mpd_error.get_mpd_ack(), add_ok=False) if request in (u'command_list_begin', u'command_list_ok_begin'): return None if command_list_index is not None: