Fix #5308 (Content Server always starts on default port 8080)

This commit is contained in:
Kovid Goyal 2010-04-17 16:05:49 +05:30
parent c1cc20c3c9
commit c290d0037c
2 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -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?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~