Make MpdFrontend start
This commit is contained in:
parent
43cb8d077c
commit
d75ca5b4e8
@ -37,6 +37,6 @@ class MpdThread(BaseThread):
|
|||||||
|
|
||||||
def run_inside_try(self):
|
def run_inside_try(self):
|
||||||
logger.debug(u'Starting MPD server thread')
|
logger.debug(u'Starting MPD server thread')
|
||||||
server = MpdServer(self.core_queue)
|
server = MpdServer()
|
||||||
server.start()
|
server.start()
|
||||||
asyncore.loop()
|
asyncore.loop()
|
||||||
|
|||||||
@ -15,9 +15,8 @@ class MpdServer(asyncore.dispatcher):
|
|||||||
for each client connection.
|
for each client connection.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, core_queue):
|
def __init__(self):
|
||||||
asyncore.dispatcher.__init__(self)
|
asyncore.dispatcher.__init__(self)
|
||||||
self.core_queue = core_queue
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Start MPD server."""
|
"""Start MPD server."""
|
||||||
@ -47,8 +46,7 @@ class MpdServer(asyncore.dispatcher):
|
|||||||
(client_socket, client_socket_address) = self.accept()
|
(client_socket, client_socket_address) = self.accept()
|
||||||
logger.info(u'MPD client connection from [%s]:%s',
|
logger.info(u'MPD client connection from [%s]:%s',
|
||||||
client_socket_address[0], client_socket_address[1])
|
client_socket_address[0], client_socket_address[1])
|
||||||
MpdSession(self, client_socket, client_socket_address,
|
MpdSession(self, client_socket, client_socket_address).start()
|
||||||
self.core_queue).start()
|
|
||||||
|
|
||||||
def handle_close(self):
|
def handle_close(self):
|
||||||
"""Handle end of client connection."""
|
"""Handle end of client connection."""
|
||||||
|
|||||||
@ -14,13 +14,11 @@ class MpdSession(asynchat.async_chat):
|
|||||||
MPD requests to the dispatcher.
|
MPD requests to the dispatcher.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, server, client_socket, client_socket_address,
|
def __init__(self, server, client_socket, client_socket_address):
|
||||||
core_queue):
|
|
||||||
asynchat.async_chat.__init__(self, sock=client_socket)
|
asynchat.async_chat.__init__(self, sock=client_socket)
|
||||||
self.server = server
|
self.server = server
|
||||||
self.client_address = client_socket_address[0]
|
self.client_address = client_socket_address[0]
|
||||||
self.client_port = client_socket_address[1]
|
self.client_port = client_socket_address[1]
|
||||||
self.core_queue = core_queue
|
|
||||||
self.input_buffer = []
|
self.input_buffer = []
|
||||||
self.authenticated = False
|
self.authenticated = False
|
||||||
self.set_terminator(LINE_TERMINATOR.encode(ENCODING))
|
self.set_terminator(LINE_TERMINATOR.encode(ENCODING))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user