mpd: Add MPD_SERVER_CONNECTION_TIMEOUT setting

This commit is contained in:
Stein Magnus Jodal 2012-12-19 23:43:48 +01:00
parent 8baf813fb6
commit 79cbdb4fbb
4 changed files with 17 additions and 2 deletions

View File

@ -15,6 +15,10 @@ v0.11.0 (in development)
**MPD frontend**
- Add :attr:`mopidy.settings.MPD_SERVER_CONNECTION_TIMEOUT` setting which
controls how long an MPD client can stay inactive before the connection is
closed by the server.
- Add support for the ``findadd`` command.
- Updated to match the MPD 0.17 protocol (Fixes: :issue:`228`):

View File

@ -23,7 +23,8 @@ class MpdFrontend(pykka.ThreadingActor, CoreListener):
network.Server(
hostname, port,
protocol=session.MpdSession, protocol_kwargs={'core': core},
max_connections=settings.MPD_SERVER_MAX_CONNECTIONS)
max_connections=settings.MPD_SERVER_MAX_CONNECTIONS,
timeout=settings.MPD_SERVER_CONNECTION_TIMEOUT)
except IOError as error:
logger.error(
'MPD server startup failed: %s',

View File

@ -174,6 +174,16 @@ MIXER = 'autoaudiomixer'
#: MIXER_TRACK = None
MIXER_TRACK = None
#: Number of seconds an MPD client can stay inactive before the connection is
#: closed by the server.
#:
#: Used by :mod:`mopidy.frontends.mpd`.
#:
#: Default::
#:
#: MPD_SERVER_CONNECTION_TIMEOUT = 60
MPD_SERVER_CONNECTION_TIMEOUT = 60
#: Which address Mopidy's MPD server should bind to.
#:
#: Used by :mod:`mopidy.frontends.mpd`.

View File

@ -291,7 +291,7 @@ class Connection(object):
return True
def timeout_callback(self):
self.stop('Client timeout out after %s seconds' % self.timeout)
self.stop('Client inactive for %ds; closing connection' % self.timeout)
return False