[Xfce4-commits] <eatmonkey:aria2-xml-rpc> Lock --daemon option
Mike Massonnet
noreply at xfce.org
Sat Jan 30 15:12:01 CET 2010
Updating branch refs/heads/aria2-xml-rpc
to 04459dfb4480ab62495c368347adca374daeb196 (commit)
from 57d261e85621f16da07d5f62d0345190ca07d571 (commit)
commit 04459dfb4480ab62495c368347adca374daeb196
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Thu Jan 28 14:23:17 2010 +0100
Lock --daemon option
The daemon option doesn't take a parameter, now this option is locked
out and won't be parsed.
src/eataria2.rb | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/eataria2.rb b/src/eataria2.rb
index 42bcc2d..ddb19cb 100644
--- a/src/eataria2.rb
+++ b/src/eataria2.rb
@@ -95,16 +95,20 @@ class Eat::Aria2 < GLib::Object
return 0 if @use_local_server == false
begin
TCPSocket.new(@hostname, @port).close
+ debug("another service already listens on #{@port}")
return -1
rescue
begin
# Create config file
FileUtils.mkdir_p(@confdir, :mode => 0700)
FileUtils.touch(@confdir+"/aria2.conf")
+ # Save conf file with restricted options (e.g. daemon=false)
+ aria2_conf = Eat::Aria2Config.new(@confdir+"/aria2.conf")
+ aria2_conf.save
# Cleanup log file
FileUtils.rm(@confdir+"/aria2.log", :force => true)
# Launch aria2c process
- command = "aria2c --disable-ipv6=true --daemon=false " \
+ command = "aria2c --disable-ipv6=true " \
"--enable-xml-rpc --xml-rpc-listen-port=#{@port} " \
"--conf-path=#{@confdir}/aria2.conf --log=#{@confdir}/aria2.log --log-level=notice " \
"--dht-file-path=#{@confdir}/dht.dat"
@@ -130,6 +134,8 @@ class Eat::Aria2 < GLib::Object
puts "Started aria2 XML-RPC Server (pid #{@@pid.to_s})..."
return @@pid
rescue
+ debug("error start_server", $!)
+ @@pid = 0
return -2
end
end
@@ -172,8 +178,6 @@ class Eat::Aria2 < GLib::Object
@@client = XMLRPC::Client.new3({:host => @hostname, :path => "/rpc",
:port => @port, :user => @user, :password => @password,
:timeout => 60})
- debug("call")
- result = nil
Timeout::timeout(5) do
result = call("aria2.getVersion")
end
@@ -544,6 +548,7 @@ class Eat::Aria2Config
file = File.open(@filename)
while !file.eof and line = file.readline
next if line !~ /^([a-zA-Z0-9-]+)=(.*)$/
+ next if line =~ /^daemon=.*$/
key = $1
val = $2.strip
if val == "true"
More information about the Xfce4-commits
mailing list