Fix #2335 : IPC lockfile issue preventing start of deluge-gtk

This commit is contained in:
Calum Lind 2013-11-19 22:11:15 +00:00
parent 3d569b23d6
commit 2520093b3e
1 changed files with 6 additions and 4 deletions

View File

@ -127,17 +127,19 @@ class IPCInterface(component.Component):
os.remove(f) os.remove(f)
lockfile = socket + ".lock" lockfile = socket + ".lock"
log.debug("Checking if lockfile exists: %s", lockfile) log.debug("Checking if lockfile exists: %s", lockfile)
if os.path.lexists(lockfile): if os.path.lexists(lockfile) or os.path.lexists(socket):
try: try:
os.kill(int(os.readlink(lockfile)), 0) os.kill(int(os.readlink(lockfile)), 0)
except OSError: except OSError:
log.debug("Removing lockfile since it's stale.") log.debug("Removing lockfile since it's stale.")
try: try:
os.remove(lockfile) os.remove(lockfile)
except OSError, ex:
log.error("Failed to delete IPC lockfile file: %s", ex)
try:
os.remove(socket) os.remove(socket)
except Exception, e: except OSError, ex:
log.error("Problem deleting lockfile or socket file!") log.error("Failed to delete IPC socket file: %s", ex)
log.exception(e)
try: try:
self.factory = Factory() self.factory = Factory()
self.factory.protocol = IPCProtocolServer self.factory.protocol = IPCProtocolServer