mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-27 11:45:44 +00:00
Catch and log ReactorNotRunning when stopping reactor in gtk
This commit is contained in:
parent
7b1e8862b4
commit
7847362dbb
@ -277,7 +277,7 @@ def fsize(fsize_b):
|
||||
return "%.1f %s" % (fsize_mb, _("MiB"))
|
||||
fsize_gb = fsize_mb / 1024.0
|
||||
return "%.1f %s" % (fsize_gb, _("GiB"))
|
||||
|
||||
|
||||
def fsize_short(fsize_b):
|
||||
"""
|
||||
Formats the bytes value into a string with K, M or G units
|
||||
|
@ -289,7 +289,7 @@ class GtkUI(object):
|
||||
def on_dialog_response(response):
|
||||
if response != gtk.RESPONSE_YES:
|
||||
# The user does not want to turn Classic Mode off, so just quit
|
||||
reactor.stop()
|
||||
self.mainwindow.quit()
|
||||
return
|
||||
# Turning off classic_mode
|
||||
self.config["classic_mode"] = False
|
||||
|
@ -44,7 +44,7 @@ try:
|
||||
import rencode
|
||||
except ImportError:
|
||||
import deluge.rencode as rencode
|
||||
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.ui.client import client
|
||||
import deluge.common
|
||||
@ -64,11 +64,11 @@ class IPCProtocolClient(Protocol):
|
||||
def connectionMade(self):
|
||||
self.transport.write(rencode.dumps(self.factory.args))
|
||||
self.transport.loseConnection()
|
||||
|
||||
|
||||
def connectionLost(self, reason):
|
||||
reactor.stop()
|
||||
self.factory.stop = True
|
||||
|
||||
|
||||
class IPCClientFactory(ClientFactory):
|
||||
protocol = IPCProtocolClient
|
||||
|
||||
@ -76,11 +76,11 @@ class IPCClientFactory(ClientFactory):
|
||||
self.stop = False
|
||||
self.args = args
|
||||
self.connect_failed = connect_failed
|
||||
|
||||
|
||||
def clientConnectionFailed(self, connector, reason):
|
||||
log.info("Connection to running instance failed. Starting new one..")
|
||||
reactor.stop()
|
||||
|
||||
|
||||
class IPCInterface(component.Component):
|
||||
def __init__(self, args):
|
||||
component.Component.__init__(self, "IPCInterface")
|
||||
@ -151,14 +151,14 @@ class IPCInterface(component.Component):
|
||||
def connect_failed(self, args):
|
||||
# This gets called when we're unable to do a connectUNIX to the ipc
|
||||
# socket. We'll delete the lock and socket files and start up Deluge.
|
||||
#reactor.stop()
|
||||
|
||||
socket = os.path.join(deluge.configmanager.get_config_dir("ipc"), "deluge-gtk")
|
||||
if os.path.exists(socket):
|
||||
try:
|
||||
os.remove(socket)
|
||||
except Exception, e:
|
||||
log.error("Unable to remove socket file: %s", e)
|
||||
|
||||
|
||||
lock = socket + ".lock"
|
||||
if os.path.lexists(lock):
|
||||
try:
|
||||
@ -173,7 +173,7 @@ class IPCInterface(component.Component):
|
||||
log.error("Unable to start IPC listening socket: %s", e)
|
||||
finally:
|
||||
process_args(args)
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
if deluge.common.windows_check():
|
||||
import win32api
|
||||
|
@ -45,6 +45,7 @@ import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.ui.gtkui.ipcinterface import process_args
|
||||
from twisted.internet import reactor, defer
|
||||
from twisted.internet.error import ReactorNotRunning
|
||||
|
||||
import deluge.common
|
||||
import common
|
||||
@ -165,7 +166,10 @@ class MainWindow(component.Component):
|
||||
return client.disconnect()
|
||||
|
||||
def stop_reactor(result):
|
||||
return reactor.stop()
|
||||
try:
|
||||
reactor.stop()
|
||||
except ReactorNotRunning:
|
||||
log.debug("Attempted to stop the reactor but it is not running...")
|
||||
|
||||
def log_failure(failure, action):
|
||||
log.error("Encountered error attempting to %s: %s" % \
|
||||
|
Loading…
x
Reference in New Issue
Block a user