bayserver-core 2.3.1 → 2.3.2

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
  SHA256:
3
- metadata.gz: 2f0a7628ec3be8f1d727392730648c785b8018968fb343dc20434549ae60abae
4
- data.tar.gz: 0ef73388d47ef99c304a1b0aaaa951eec6d25222a5fbb0bd71e7f6aeb37edebd
3
+ metadata.gz: ef1870c148ef4f045575bdd31e28b5e13808013fa159e0642a627471e0b80962
4
+ data.tar.gz: 0247c5d8b92f4c9f1cf95b20ae02687202d524c6edd82158711bce98fa5e8e6e
5
5
  SHA512:
6
- metadata.gz: cd9122b0cfaf0eae17477d39ec7fd9e323a7944210222a6182861a91a11087da69560d4e70bca2f25c14f76804af0e57ffbf09c3c5fd2f5337b80351e98a74d6
7
- data.tar.gz: 32b56a60249f626736a1102681cabbc1dec4f7dca68ee8e156c5a42930a04b38c69ca77aeef8eedc979d3ca419b5371ccb12ee1d758675c1af1b3facda28f439
6
+ metadata.gz: c3460ae4f7b5d50945fb20e5f6072838fe7277ccf6d6b9f0cd9d8e51e4ecd3c87a729121cc1d502edb8ddb120841e99377a63ba62324515a74de06d27fe769b6
7
+ data.tar.gz: 22d1f706b151704256cf55526e8b4bc6d29a04c2ab543c9803cb32316719239140997390d7b88b500e1d248cc8281821e68666ba68f2abdddd247880a2dbc698
@@ -196,7 +196,7 @@ module Baykit
196
196
  end # while
197
197
 
198
198
  rescue => e
199
- BayLog.fatal(e)
199
+ BayLog.fatal_e(e)
200
200
  ensure
201
201
  BayLog.info("%s end", self)
202
202
  shutdown()
@@ -211,13 +211,15 @@ module Baykit
211
211
  end
212
212
 
213
213
  @command_receiver.end()
214
+ @non_blocking_handler.close_all()
215
+
214
216
  GrandAgent.listeners.each do |lis|
215
217
  lis.remove(self)
216
218
  end
217
219
 
218
220
  GrandAgent.agents.delete(@agent_id)
219
- clean()
220
221
 
222
+ @agent_id = -1
221
223
  if BayServer.harbor.multi_core
222
224
  exit(1)
223
225
  end
@@ -225,6 +227,10 @@ module Baykit
225
227
 
226
228
  def abort_agent()
227
229
  BayLog.info("%s abort", self)
230
+
231
+ if BayServer.harbor.multi_core
232
+ exit(1)
233
+ end
228
234
  end
229
235
 
230
236
  def req_shutdown()
@@ -280,11 +286,6 @@ module Baykit
280
286
  val = IOUtil.read_int32(pipe_fd)
281
287
  end
282
288
 
283
- def clean()
284
- @non_blocking_handler.close_all()
285
- @agent_id = -1
286
- end
287
-
288
289
  ######################################################
289
290
  # class methods
290
291
  ######################################################
@@ -25,11 +25,13 @@ module Baykit
25
25
  attr :agent_id
26
26
  attr :anchorable
27
27
  attr :communication_channel
28
+ attr :child_pid
28
29
 
29
- def initialize(agt_id, anchorable, com_channel)
30
+ def initialize(agt_id, anchorable, com_channel, child_pid)
30
31
  @agent_id = agt_id
31
32
  @anchorable = anchorable
32
33
  @communication_channel = com_channel
34
+ @child_pid = child_pid
33
35
  end
34
36
 
35
37
  def to_s()
@@ -42,7 +44,7 @@ module Baykit
42
44
  if res == nil || res == GrandAgent::CMD_CLOSE
43
45
  BayLog.debug("%s read Close", self)
44
46
  close()
45
- GrandAgentMonitor.agent_aborted(@agent_id, @anchorable)
47
+ agent_aborted()
46
48
  else
47
49
  BayLog.debug("%s read OK: %d", self, res)
48
50
  end
@@ -81,6 +83,33 @@ module Baykit
81
83
  @communication_channel.close()
82
84
  end
83
85
 
86
+ def agent_aborted()
87
+ BayLog.info(BayMessage.get(:MSG_GRAND_AGENT_SHUTDOWN, @agent_id))
88
+
89
+ if @child_pid != nil
90
+ begin
91
+ Process.kill("TERM", @child_pid)
92
+ rescue => e
93
+ BayLog.debug_e(e, "Error on killing process")
94
+ end
95
+ Process.wait(@child_pid)
96
+ end
97
+ GrandAgentMonitor.monitors.delete(@agent_id)
98
+
99
+ if not GrandAgentMonitor.finale
100
+ if GrandAgentMonitor.monitors.length < GrandAgentMonitor.num_agents
101
+ begin
102
+ if !BayServer.harbor.multi_core
103
+ GrandAgent.add(-1, @anchorable)
104
+ end
105
+ GrandAgentMonitor.add(@anchorable)
106
+ rescue => e
107
+ BayLog.error_e(e)
108
+ end
109
+ end
110
+ end
111
+ end
112
+
84
113
  ########################################
85
114
  # Class methods
86
115
  ########################################
@@ -151,32 +180,16 @@ module Baykit
151
180
  agt.run()
152
181
  end
153
182
 
183
+ child = nil
184
+
154
185
  end
155
186
 
156
187
  @monitors[agt_id] =
157
188
  GrandAgentMonitor.new(
158
189
  agt_id,
159
190
  anchoroable,
160
- client_socket)
161
- end
162
-
163
- def self.agent_aborted(agt_id, anchorable)
164
- BayLog.info(BayMessage.get(:MSG_GRAND_AGENT_SHUTDOWN, agt_id))
165
-
166
- @monitors.delete(agt_id)
167
-
168
- if not @finale
169
- if @monitors.length < @num_agents
170
- begin
171
- if !BayServer.harbor.multi_core
172
- GrandAgent.add(-1, anchorable)
173
- end
174
- add(anchorable)
175
- rescue => e
176
- BayLog.error_e(e)
177
- end
178
- end
179
- end
191
+ client_socket,
192
+ child)
180
193
  end
181
194
 
182
195
  def self.reload_cert_all()
@@ -77,6 +77,8 @@ module Baykit
77
77
  end
78
78
  tur.init(tur_key, self)
79
79
  @active_tours.append(tur)
80
+ else
81
+ tur.ship.check_ship_id(@ship_id)
80
82
  end
81
83
  end
82
84
  return tur
@@ -203,7 +203,7 @@ module Baykit
203
203
  end
204
204
 
205
205
  def return_protocol_handler(agt, proto_hnd)
206
- BayLog.debug("%s Return protocol handler: ", proto_hnd)
206
+ BayLog.debug("%s Return protocol handler", proto_hnd)
207
207
  PortBase.get_protocol_handler_store(proto_hnd.protocol, agt).Return(proto_hnd)
208
208
  end
209
209
 
@@ -20,6 +20,7 @@ module Baykit
20
20
  end
21
21
 
22
22
  def remove(agt)
23
+ BayLog.debug("%s Remove tax runner", agt)
23
24
  TaxiRunner.runners[agt.agent_id - 1].terminate()
24
25
  TaxiRunner.runners[agt.agent_id - 1] = nil
25
26
  end
@@ -338,7 +338,7 @@ module Baykit
338
338
  begin
339
339
  @tour.ship.send_error(@tour.ship_id, @tour, status, msg, err)
340
340
  rescue IOError => e
341
- BayLog.debug("%s Error on sending error", self)
341
+ BayLog.debug_e(e, "%s Error on sending error", self)
342
342
  @tour.change_state(Tour::TOUR_ID_NOCHECK, Tour::TourState::ABORTED)
343
343
  end
344
344
  @header_sent = true
@@ -1,7 +1,7 @@
1
1
  module Baykit
2
2
  module BayServer
3
3
  class Version
4
- VERSION='2.3.1'
4
+ VERSION='2.3.2'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bayserver-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michisuke-P
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2023-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: BayServer is one of the high-speed web servers. It operates as a single-threaded,
14
14
  asynchronous server, which makes it exceptionally fast. It also supports multi-core