Cleanup leftover fd sockets on restart

This commit is contained in:
echel0n 2014-06-30 02:38:07 -07:00
parent 6df96f8cdb
commit 33a28d20a3
2 changed files with 6 additions and 12 deletions

View file

@ -53,25 +53,20 @@ import threading
import signal
import traceback
import getopt
import time
import sickbeard
import tornado.ioloop
import tornado.autoreload
from sickbeard import db
from sickbeard.tv import TVShow
from sickbeard import logger
from sickbeard import webserveInit
from sickbeard import autoreload_shutdown
from sickbeard.version import SICKBEARD_VERSION
from sickbeard.databases.mainDB import MIN_DB_VERSION
from sickbeard.databases.mainDB import MAX_DB_VERSION
from lib.configobj import ConfigObj
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.ioloop import IOLoop
signal.signal(signal.SIGINT, sickbeard.sig_handler)
signal.signal(signal.SIGTERM, sickbeard.sig_handler)

View file

@ -1300,17 +1300,16 @@ def saveAll():
logger.log(u"Saving config file to disk")
save_config()
def cleanup_tornado_sockets(io_loop):
for fd in io_loop._handlers.keys():
def saveAndShutdown():
halt()
saveAll()
for fd in IOLoop.current()._handlers.keys():
try:
os.close(fd)
except Exception:
pass
def saveAndShutdown():
halt()
saveAll()
def invoke_command(to_call, *args, **kwargs):
def delegate():