packet 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/packet.rb +1 -1
- data/lib/packet/packet_core.rb +16 -10
- data/lib/packet/packet_master.rb +8 -1
- metadata +2 -2
data/lib/packet.rb
CHANGED
data/lib/packet/packet_core.rb
CHANGED
@@ -286,16 +286,22 @@ module Packet
|
|
286
286
|
end
|
287
287
|
|
288
288
|
def check_for_timer_events
|
289
|
-
@timer_hash.delete_if do |key,timer|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
end
|
289
|
+
# @timer_hash.delete_if do |key,timer|
|
290
|
+
# if timer.cancel_flag
|
291
|
+
# true
|
292
|
+
# elsif timer.run_now?
|
293
|
+
# timer.run
|
294
|
+
# (timer.respond_to?(:interval)) ? false : true
|
295
|
+
# else
|
296
|
+
# false
|
297
|
+
# end
|
298
|
+
# end
|
299
|
+
|
300
|
+
ready_timers = @timer_hash.collect { |key,timer| timer if timer.run_now? }.compact
|
301
|
+
ready_timers.each { |timer| timer.run }
|
302
|
+
@timer_hash.delete_if { |key,timer|
|
303
|
+
timer.cancel_flag || (!timer.respond_to?(:interval) && ready_timers.include?(timer)) || false
|
304
|
+
}
|
299
305
|
end
|
300
306
|
|
301
307
|
# close the connection with internal specified socket
|
data/lib/packet/packet_master.rb
CHANGED
@@ -102,16 +102,23 @@ module Packet
|
|
102
102
|
option_dump = Marshal.dump(worker_options)
|
103
103
|
option_dump_length = option_dump.length
|
104
104
|
master_write_end.write(option_dump)
|
105
|
+
worker_name_key = gen_worker_key(t_worker_name,worker_options[:worker_key])
|
105
106
|
|
106
107
|
if(!(pid = fork))
|
107
108
|
[master_write_end,master_read_end].each { |x| x.close }
|
108
109
|
[worker_read_end,worker_write_end].each { |x| enable_nonblock(x) }
|
110
|
+
begin
|
111
|
+
if(ARGV[0] == 'start')
|
112
|
+
log_file = File.open("log/#{worker_name_key}.log","w")
|
113
|
+
[STDIN, STDOUT, STDERR].each {|desc| desc.reopen(log_file)}
|
114
|
+
end
|
115
|
+
rescue; end
|
109
116
|
exec form_cmd_line(worker_read_end.fileno,worker_write_end.fileno,t_worker_name,option_dump_length)
|
110
117
|
end
|
111
118
|
Process.detach(pid)
|
112
119
|
[master_read_end,master_write_end].each { |x| enable_nonblock(x) }
|
113
120
|
|
114
|
-
|
121
|
+
|
115
122
|
|
116
123
|
if worker_pimp && !worker_pimp.empty?
|
117
124
|
require worker_pimp
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hemant Kumar
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-03 00:00:00 +05:30
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|