rsence-pre 2.2.0.4 → 2.2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/conf/default_conf.yaml +13 -0
- data/conf/rsence_command_strings.yaml +10 -0
- data/lib/conf/argv.rb +11 -1
- data/lib/conf/default.rb +1 -0
- data/lib/daemon/daemon.rb +45 -16
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.0.
|
1
|
+
2.2.0.5.pre
|
data/conf/default_conf.yaml
CHANGED
@@ -36,6 +36,19 @@
|
|
36
36
|
# how many milliseconds to wait before doing an idle poll
|
37
37
|
:server_poll_interval: 2000 # 2 seconds
|
38
38
|
#
|
39
|
+
# The settings for the daemon
|
40
|
+
:daemon:
|
41
|
+
#
|
42
|
+
# How long to wait before binding the broker to the
|
43
|
+
# HTTP address and port after starting the Transporter.
|
44
|
+
# A value of -1 disables the broker completely.
|
45
|
+
# Before waiting, the daemon starts all subsystems except the
|
46
|
+
# http handling front-end (Broker).
|
47
|
+
# Useful in situations where RSence itself configures the
|
48
|
+
# network interfaces or the interfaces become available after
|
49
|
+
# RSence is started.
|
50
|
+
:http_delayed_start: 0
|
51
|
+
#
|
39
52
|
# Switches on debug-mode:
|
40
53
|
# - Generates more output
|
41
54
|
# - Each time /hello is post-requested:
|
@@ -278,6 +278,16 @@
|
|
278
278
|
Only available on Mac OS X and other systems with a
|
279
279
|
'say' command installed.
|
280
280
|
|
281
|
+
--http-delayed-start <number> Waits for <number> of seconds before starting
|
282
|
+
the HTTP Broker after starting the Transporter.
|
283
|
+
A value of -1 disables the broker completely.
|
284
|
+
Before waiting, the daemon starts all subsystems except the
|
285
|
+
http handling front-end (Broker).
|
286
|
+
Useful in situations where RSence itself configures the
|
287
|
+
network interfaces or the interfaces become available after
|
288
|
+
RSence is started.
|
289
|
+
|
290
|
+
|
281
291
|
:initenv: |+
|
282
292
|
Alias name of the 'init' command.
|
283
293
|
|
data/lib/conf/argv.rb
CHANGED
@@ -110,6 +110,7 @@ module RSence
|
|
110
110
|
:autoupdate => false, # -a --auto-update
|
111
111
|
:latency => 0, # --latency
|
112
112
|
:say => false, # -S --say
|
113
|
+
:http_delayed_start => nil, # --http-delayed-start
|
113
114
|
|
114
115
|
# client_pkg (not supported yet)
|
115
116
|
:client_pkg_no_gzip => false, # --build-no-gzip
|
@@ -128,7 +129,7 @@ module RSence
|
|
128
129
|
if @argv.length >= 2
|
129
130
|
@argv[1..-1].each_with_index do |arg,i|
|
130
131
|
if expect_option
|
131
|
-
if [:port
|
132
|
+
if [ :port, :latency, :http_delayed_start ].include?(option_name) and arg.to_i.to_s != arg
|
132
133
|
puts ERB.new( @@strs[:messages][:invalid_option_expected_number] ).result( binding )
|
133
134
|
exit
|
134
135
|
elsif option_name == :conf_files
|
@@ -138,6 +139,8 @@ module RSence
|
|
138
139
|
else
|
139
140
|
@args[:conf_files].push( arg )
|
140
141
|
end
|
142
|
+
elsif option_name == :http_delayed_start
|
143
|
+
@args[:http_delayed_start] = arg.to_i
|
141
144
|
else
|
142
145
|
arg = arg.to_i if option_name == :latency
|
143
146
|
@args[option_name] = arg
|
@@ -163,6 +166,9 @@ module RSence
|
|
163
166
|
elsif arg == '--addr'
|
164
167
|
expect_option = true
|
165
168
|
option_name = :addr
|
169
|
+
elsif arg == '--http-delayed-start'
|
170
|
+
expect_option = true
|
171
|
+
option_name = :http_delayed_start
|
166
172
|
elsif arg == '--server'
|
167
173
|
expect_option = true
|
168
174
|
option_name = :server
|
@@ -793,12 +799,16 @@ module RSence
|
|
793
799
|
puts version
|
794
800
|
exit
|
795
801
|
elsif [:run,:start,:stop,:restart].include? cmd
|
802
|
+
puts "RSence #{@@version} -- Ruby #{RUBY_VERSION}"
|
796
803
|
parse_startup_argv
|
797
804
|
elsif cmd == :status
|
805
|
+
puts "RSence #{@@version} -- Ruby #{RUBY_VERSION}"
|
798
806
|
parse_status_argv
|
799
807
|
elsif cmd == :save
|
808
|
+
puts "RSence #{@@version} -- Ruby #{RUBY_VERSION}"
|
800
809
|
parse_save_argv
|
801
810
|
elsif cmd == :initenv or cmd == :init
|
811
|
+
puts "RSence #{@@version} -- Ruby #{RUBY_VERSION}"
|
802
812
|
parse_initenv_argv
|
803
813
|
end
|
804
814
|
else
|
data/lib/conf/default.rb
CHANGED
@@ -143,6 +143,7 @@ module RSence
|
|
143
143
|
config[:http_server][:bind_address] = args[:addr] if args[:addr]
|
144
144
|
config[:http_server][:rack_require] = args[:server] if args[:server]
|
145
145
|
config[:session_conf][:reset_sessions] = true if args[:reset_ses]
|
146
|
+
config[:daemon][:http_delayed_start] = args[:http_delayed_start] if args[:http_delayed_start] != nil
|
146
147
|
|
147
148
|
config[:client_pkg][:no_obfuscation] = true if args[:client_pkg_no_obfuscation]
|
148
149
|
config[:client_pkg][:no_whitespace_removal] = true if args[:client_pkg_no_whitespace_removal]
|
data/lib/daemon/daemon.rb
CHANGED
@@ -276,9 +276,44 @@ module RSence
|
|
276
276
|
"RSence-#{RSence.version} on #{url} in #{env_path}"
|
277
277
|
end
|
278
278
|
|
279
|
+
def start_broker( conf )
|
280
|
+
http_delayed_seconds = RSence.config[:daemon][:http_delayed_start].to_i
|
281
|
+
if http_delayed_seconds == -1
|
282
|
+
puts "The HTTP Broker is disabled. RSence won't bind a http listener to any address."
|
283
|
+
else
|
284
|
+
if http_delayed_seconds > 0
|
285
|
+
puts "Delaying the start of the HTTP Broker by #{http_delayed_seconds} seconds."
|
286
|
+
if http_delayed_seconds > 10
|
287
|
+
# report when starting in 10 second intervals
|
288
|
+
sleep_remainder = http_delayed_seconds % 10
|
289
|
+
sleep_count = http_delayed_seconds / 10
|
290
|
+
sleep_time_left = http_delayed_seconds
|
291
|
+
sleep_count.times do |sleep_count_num|
|
292
|
+
puts "Waiting #{sleep_time_left} seconds..."
|
293
|
+
sleep 10
|
294
|
+
sleep_time_left -= 10
|
295
|
+
end
|
296
|
+
if sleep_remainder != 0
|
297
|
+
puts "Waiting #{sleep_remainder} seconds..."
|
298
|
+
sleep sleep_remainder
|
299
|
+
end
|
300
|
+
else
|
301
|
+
sleep http_delayed_seconds
|
302
|
+
end
|
303
|
+
puts "Starting the HTTP Broker now."
|
304
|
+
end
|
305
|
+
# This is the main http handler instance:
|
306
|
+
@broker = Broker.start(
|
307
|
+
@transporter,
|
308
|
+
conf
|
309
|
+
)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
279
313
|
# RSence top-level run handler. Almost identical to start.
|
280
314
|
def run
|
281
315
|
|
316
|
+
# Sets the process name
|
282
317
|
$0 = ps_name
|
283
318
|
|
284
319
|
puts "Starting as a foreground process." if RSence.args[:verbose]
|
@@ -291,13 +326,9 @@ module RSence
|
|
291
326
|
unless RSence.args[:log_fg]
|
292
327
|
Daemon.start_logging( self )
|
293
328
|
end
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
@transporter,
|
298
|
-
conf
|
299
|
-
)
|
300
|
-
|
329
|
+
|
330
|
+
start_broker( conf )
|
331
|
+
|
301
332
|
end
|
302
333
|
|
303
334
|
# Returns the pid file path.
|
@@ -323,24 +354,22 @@ module RSence
|
|
323
354
|
# Called by Controller#start, contains RSence-specific operations
|
324
355
|
def start
|
325
356
|
|
357
|
+
# Sets the process name
|
326
358
|
$0 = ps_name
|
327
359
|
|
328
360
|
@transporter = Transporter.new
|
329
|
-
|
361
|
+
|
330
362
|
conf = RSence.config[:http_server]
|
331
|
-
|
363
|
+
|
332
364
|
unless RSence.args[:log_fg]
|
333
365
|
Daemon.start_logging( self )
|
334
366
|
STDIN.reopen( "/dev/null" )
|
335
367
|
end
|
336
|
-
|
368
|
+
|
337
369
|
Process.setsid
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
@transporter,
|
342
|
-
conf
|
343
|
-
)
|
370
|
+
|
371
|
+
start_broker( conf )
|
372
|
+
|
344
373
|
yield @broker
|
345
374
|
|
346
375
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsence-pre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 117
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 2
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 2.2.0.
|
10
|
+
- 5
|
11
|
+
version: 2.2.0.5
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Riassence Inc.
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-04-01 00:00:00 +03:00
|
20
20
|
default_executable: rsence-pre
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|