From c290d0037cc5585a836c0b4cdcc92cdea15833f6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 17 Apr 2010 16:05:49 +0530 Subject: [PATCH] Fix #5308 (Content Server always starts on default port 8080) --- src/calibre/library/server.py | 10 +++++++--- src/calibre/manual/faq.rst | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/calibre/library/server.py b/src/calibre/library/server.py index 8c024aa0db..7023d72f0c 100644 --- a/src/calibre/library/server.py +++ b/src/calibre/library/server.py @@ -32,6 +32,8 @@ from calibre.utils.mdns import publish as publish_zeroconf, \ from calibre.ebooks.metadata import fmt_sidx, title_sort from calibre.utils.date import now as nowf, fromtimestamp +listen_on = '0.0.0.0' + def strftime(fmt='%Y/%m/%d %H:%M:%S', dt=None): if not hasattr(dt, 'timetuple'): dt = nowf() @@ -353,14 +355,13 @@ class LibraryServer(object): path = P('content_server') self.build_time = fromtimestamp(os.stat(path).st_mtime) self.default_cover = open(P('content_server/default_cover.jpg'), 'rb').read() - cherrypy.config.update({ 'log.screen' : opts.develop, 'engine.autoreload_on' : opts.develop, 'tools.log_headers.on' : opts.develop, 'checker.on' : opts.develop, 'request.show_tracebacks': show_tracebacks, - 'server.socket_host' : '0.0.0.0', + 'server.socket_host' : listen_on, 'server.socket_port' : opts.port, 'server.socket_timeout' : opts.timeout, #seconds 'server.thread_pool' : opts.thread_pool, # number of threads @@ -438,7 +439,10 @@ class LibraryServer(object): cherrypy.log.error(traceback.format_exc()) def exit(self): - cherrypy.engine.exit() + try: + cherrypy.engine.exit() + finally: + cherrypy.server.httpserver = None def get_cover(self, id, thumbnail=False): cover = self.db.cover(id, index_is_id=True, as_file=False) diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index ed25c2c90a..b88c4474df 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -165,6 +165,8 @@ Replace ``192.168.1.2`` with the local IP address of the computer running |app|. If you get timeout errors while browsing the calibre catalog in Stanza, try increasing the connection timeout value in the stanza settings. Go to Info->Settings and increase the value of Download Timeout. +Note that neither the Stanza, nor the ReadMe apps are in anyway associated with |app|. + How do I use |app| with my Android phone? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~