mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 16:08:40 +00:00
Do not fail to start if deluged.pid contains no data
This commit is contained in:
parent
7343c5bb39
commit
0bc97733bf
1 changed files with 9 additions and 4 deletions
|
@ -51,9 +51,14 @@ class Daemon(object):
|
||||||
# Check for another running instance of the daemon
|
# Check for another running instance of the daemon
|
||||||
if os.path.isfile(deluge.configmanager.get_config_dir("deluged.pid")):
|
if os.path.isfile(deluge.configmanager.get_config_dir("deluged.pid")):
|
||||||
# Get the PID and the port of the supposedly running daemon
|
# Get the PID and the port of the supposedly running daemon
|
||||||
(pid, port) = open(deluge.configmanager.get_config_dir("deluged.pid")).read().strip().split(";")
|
try:
|
||||||
pid = int(pid)
|
(pid, port) = open(deluge.configmanager.get_config_dir("deluged.pid")).read().strip().split(";")
|
||||||
port = int(port)
|
pid = int(pid)
|
||||||
|
port = int(port)
|
||||||
|
except ValueError:
|
||||||
|
pid = None
|
||||||
|
port = None
|
||||||
|
|
||||||
|
|
||||||
def process_running(pid):
|
def process_running(pid):
|
||||||
if deluge.common.windows_check():
|
if deluge.common.windows_check():
|
||||||
|
@ -73,7 +78,7 @@ class Daemon(object):
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if process_running(pid):
|
if pid is not None and process_running(pid):
|
||||||
# Ok, so a process is running with this PID, let's make doubly-sure
|
# Ok, so a process is running with this PID, let's make doubly-sure
|
||||||
# it's a deluged process by trying to open a socket to it's port.
|
# it's a deluged process by trying to open a socket to it's port.
|
||||||
import socket
|
import socket
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue