serverengine 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27ee21f3ac6b04119621a1ccafc43da3a285465a
4
- data.tar.gz: 2f145a46ec4de7b4034e807458813b8def7f8de8
3
+ metadata.gz: e1905531d61188949bea25a5bd1aa56882b9fd0e
4
+ data.tar.gz: 225c5c5204167c726710c4790def2f5b7794e179
5
5
  SHA512:
6
- metadata.gz: 5b88fe6bcebd72115a8d9c4c58296a831e39625fc763e2ed09a359674dfe1d849fa1ab7c14d732870bfd6b67183dccdc9acf72f2d1506c7bd8675a708376ebd6
7
- data.tar.gz: e660e7a7900db257d0022e441cc414bbbd0c6388a3f05c35b51190c1c1e14cbe5e9d84660cc957cef52c4f9c348e6d38e4c9608f2cff35260ff1c93ae4585c97
6
+ metadata.gz: c2a704566a28f1e90f44934d97e976e82aee1d6867b77bc6497b015c38fef2f538583bb614bdef18de91061b9e1927aa864c7eb50e5e1b0448f8b73eeb4293b6
7
+ data.tar.gz: c5bab7f53971af7eeaeb4a0a7a58bab5c921d6d39d2c0e00ea154c6cedce39ebe23bf675f8f31896d0dc5fed3b36b218d1e8e079402c97e1d86894dd0448b2a1
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
+ - 2.1.10
4
5
  - 2.2.4
5
6
  - 2.3.0
6
7
  - ruby-head
data/Changelog CHANGED
@@ -1,3 +1,9 @@
1
+ 2016-05-19 version 1.6.4:
2
+
3
+ * Refactor to delete some warnings
4
+ * Fix infinite self call bug in SignalTread
5
+ * Add ruby 2.1 support for TravisCI
6
+
1
7
  2016-04-27 version 1.6.3:
2
8
 
3
9
  * Fix Socket Manager for UDP to adapt to ipv6
@@ -29,6 +29,8 @@ module ServerEngine
29
29
  end
30
30
  end
31
31
 
32
+ @logger = nil
33
+
32
34
  reload_config
33
35
  end
34
36
 
@@ -31,8 +31,8 @@ module ServerEngine
31
31
  @daemonize = @config.fetch(:daemonize, false)
32
32
 
33
33
  if @config.fetch(:supervisor, false)
34
- @create_server_proc = lambda do |load_config_proc,logger|
35
- s = Supervisor.new(server_module, worker_module, load_config_proc)
34
+ @create_server_proc = lambda do |_load_config_proc,logger|
35
+ s = Supervisor.new(server_module, worker_module, _load_config_proc)
36
36
  s.logger = logger
37
37
  s
38
38
  end
@@ -32,6 +32,7 @@ module ServerEngine
32
32
  def initialize(logdev, config={})
33
33
  @rotate_age = config[:log_rotate_age] || 5
34
34
  @rotate_size = config[:log_rotate_size] || 1048576
35
+ @file_dev = nil
35
36
 
36
37
  if RUBY_VERSION < "2.1.0"
37
38
  # Ruby < 2.1.0 has a problem around log rotation with multiprocess:
@@ -54,7 +54,7 @@ module ServerEngine
54
54
  end
55
55
 
56
56
  def handlers
57
- handlers.dup
57
+ @handlers.dup
58
58
  end
59
59
 
60
60
  def stop
@@ -149,7 +149,7 @@ module ServerEngine
149
149
  while true
150
150
  # keep the child process alive in this loop
151
151
  until @detach_flag.wait(0.5)
152
- if stat = try_join
152
+ if try_join
153
153
  return if @stop # supervisor stoppped explicitly
154
154
 
155
155
  # child process died unexpectedly.
@@ -1,3 +1,3 @@
1
1
  module ServerEngine
2
- VERSION = "1.6.3"
2
+ VERSION = "1.6.4"
3
3
  end
@@ -29,101 +29,100 @@ def test_state(key)
29
29
  return data[key] || 0
30
30
  end
31
31
 
32
- shared_context 'test server and worker' do
33
- before { reset_test_state }
34
-
35
- def wait_for_fork
36
- sleep 0.8
32
+ module TestServer
33
+ def initialize
34
+ incr_test_state :server_initialize
37
35
  end
38
36
 
39
- def wait_for_stop
40
- sleep 0.8
37
+ def before_run
38
+ incr_test_state :server_before_run
41
39
  end
42
40
 
43
- def wait_for_restart
44
- sleep 1.5
41
+ def after_run
42
+ incr_test_state :server_after_run
45
43
  end
46
44
 
47
- module TestServer
48
- def initialize
49
- incr_test_state :server_initialize
50
- end
45
+ def after_start
46
+ incr_test_state :server_after_start
47
+ end
51
48
 
52
- def before_run
53
- incr_test_state :server_before_run
49
+ def stop(stop_graceful)
50
+ incr_test_state :server_stop
51
+ if stop_graceful
52
+ incr_test_state :server_stop_graceful
53
+ else
54
+ incr_test_state :server_stop_immediate
54
55
  end
56
+ super
57
+ end
55
58
 
56
- def after_run
57
- incr_test_state :server_after_run
59
+ def restart(stop_graceful)
60
+ incr_test_state :server_restart
61
+ if stop_graceful
62
+ incr_test_state :server_restart_graceful
63
+ else
64
+ incr_test_state :server_restart_immediate
58
65
  end
66
+ super
67
+ end
59
68
 
60
- def after_start
61
- incr_test_state :server_after_start
62
- end
69
+ def reload
70
+ incr_test_state :server_reload
71
+ super
72
+ end
63
73
 
64
- def stop(stop_graceful)
65
- incr_test_state :server_stop
66
- if stop_graceful
67
- incr_test_state :server_stop_graceful
68
- else
69
- incr_test_state :server_stop_immediate
70
- end
71
- super
72
- end
74
+ def detach
75
+ incr_test_state :server_detach
76
+ super
77
+ end
78
+ end
73
79
 
74
- def restart(stop_graceful)
75
- incr_test_state :server_restart
76
- if stop_graceful
77
- incr_test_state :server_restart_graceful
78
- else
79
- incr_test_state :server_restart_immediate
80
- end
81
- super
82
- end
80
+ module TestWorker
81
+ def initialize
82
+ incr_test_state :worker_initialize
83
+ @stop_flag = BlockingFlag.new
84
+ end
83
85
 
84
- def reload
85
- incr_test_state :server_reload
86
- super
87
- end
86
+ def before_fork
87
+ incr_test_state :worker_before_fork
88
+ end
88
89
 
89
- def detach
90
- incr_test_state :server_detach
91
- super
90
+ def run
91
+ incr_test_state :worker_run
92
+ 5.times do
93
+ # repeats 5 times because signal handlers
94
+ # interrupts wait
95
+ @stop_flag.wait(5.0)
92
96
  end
97
+ @stop_flag.reset!
93
98
  end
94
99
 
95
- module TestWorker
96
- def initialize
97
- incr_test_state :worker_initialize
98
- @stop_flag = BlockingFlag.new
99
- end
100
+ def stop
101
+ incr_test_state :worker_stop
102
+ @stop_flag.set!
103
+ end
100
104
 
101
- def before_fork
102
- incr_test_state :worker_before_fork
103
- end
105
+ def reload
106
+ incr_test_state :worker_reload
107
+ end
104
108
 
105
- def run
106
- incr_test_state :worker_run
107
- 5.times do
108
- # repeats 5 times because signal handlers
109
- # interrupts wait
110
- @stop_flag.wait(5.0)
111
- end
112
- @stop_flag.reset!
113
- end
109
+ def after_start
110
+ incr_test_state :worker_after_start
111
+ end
112
+ end
114
113
 
115
- def stop
116
- incr_test_state :worker_stop
117
- @stop_flag.set!
118
- end
114
+ shared_context 'test server and worker' do
115
+ before { reset_test_state }
119
116
 
120
- def reload
121
- incr_test_state :worker_reload
122
- end
117
+ def wait_for_fork
118
+ sleep 0.8
119
+ end
123
120
 
124
- def after_start
125
- incr_test_state :worker_after_start
126
- end
121
+ def wait_for_stop
122
+ sleep 0.8
127
123
  end
128
124
 
125
+ def wait_for_restart
126
+ sleep 1.5
127
+ end
129
128
  end
@@ -39,7 +39,7 @@ describe ServerEngine::SignalThread do
39
39
  it 'signal in handler' do
40
40
  n = 0
41
41
 
42
- t = SignalThread.new do |st|
42
+ SignalThread.new do |st|
43
43
  st.trap('QUIT') do
44
44
  if n < 3
45
45
  Process.kill('QUIT', Process.pid)
@@ -55,8 +55,6 @@ describe ServerEngine::SignalThread do
55
55
  end
56
56
 
57
57
  it 'stop in handler' do
58
- n = 0
59
-
60
58
  t = SignalThread.new do |st|
61
59
  st.trap('QUIT') { st.stop }
62
60
  end
@@ -70,7 +68,7 @@ describe ServerEngine::SignalThread do
70
68
  it 'should not deadlock' do
71
69
  n = 0
72
70
 
73
- t = SignalThread.new do |st|
71
+ SignalThread.new do |st|
74
72
  st.trap('CONT') { n += 1 }
75
73
  end
76
74
 
@@ -7,7 +7,7 @@ describe ServerEngine::SocketManager do
7
7
  end
8
8
 
9
9
  after(:each) do
10
- File.unlink(server_path) if File.exists?(server_path)
10
+ File.unlink(server_path) if File.exist?(server_path)
11
11
  end
12
12
 
13
13
  if ServerEngine.windows?
@@ -37,7 +37,7 @@ describe ServerEngine::SocketManager do
37
37
  incr_test_state(:is_tcp_server) if tcp.is_a?(TCPServer)
38
38
  incr_test_state(:is_udp_socket) if udp.is_a?(UDPSocket)
39
39
 
40
- data, from = udp.recvfrom(10)
40
+ data, _from = udp.recvfrom(10)
41
41
  incr_test_state(:udp_data_sent) if data == "ok"
42
42
 
43
43
  s = tcp.accept
@@ -89,7 +89,7 @@ describe ServerEngine::SocketManager do
89
89
  incr_test_state(:is_tcp_server) if tcp.is_a?(TCPServer)
90
90
  incr_test_state(:is_udp_socket) if udp.is_a?(UDPSocket)
91
91
 
92
- data, from = udp.recvfrom(10)
92
+ data, _from = udp.recvfrom(10)
93
93
  incr_test_state(:udp_data_sent) if data == "ok"
94
94
 
95
95
  s = tcp.accept
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sigdump
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.2.0
123
+ rubygems_version: 2.4.5
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: ServerEngine - multiprocess server framework