Example #1
0
 def start(self):
     """Start MPD server."""
     try:
         self.set_socket(network.create_socket())
         self.set_reuse_addr()
         hostname = network.format_hostname(settings.MPD_SERVER_HOSTNAME)
         port = settings.MPD_SERVER_PORT
         logger.debug(u'MPD server is binding to [%s]:%s', hostname, port)
         self.bind((hostname, port))
         self.listen(1)
         logger.info(u'MPD server running at [%s]:%s', hostname, port)
     except IOError, e:
         logger.error(u'MPD server startup failed: %s' %
             str(e).decode('utf-8'))
         sys.exit(1)
Example #2
0
 def test_ipv6_socket(self, socket_mock):
     network.create_socket()
     self.assertEqual(socket_mock.call_args[0], (socket.AF_INET6, socket.SOCK_STREAM))
Example #3
0
 def test_ipv6_socket(self, socket_mock):
     network.create_socket()
     self.assertEqual(socket_mock.call_args[0],
                      (socket.AF_INET6, socket.SOCK_STREAM))