示例#1
0
文件: server.py 项目: Amli/mopidy
 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)
示例#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))
示例#3
0
文件: utils_test.py 项目: xim/mopidy
 def test_ipv6_socket(self, socket_mock):
     network.create_socket()
     self.assertEqual(socket_mock.call_args[0],
                      (socket.AF_INET6, socket.SOCK_STREAM))