bayserver-core 3.3.1 → 3.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4df3cb76d96f99278b232a1deab31c4da2888d16748bb6a9aa3a7812163fa4fa
4
- data.tar.gz: 53ad43da3c1929e288d2dfb22b5d96a92db55b0e513ad4d9c33a739327a8b9ab
3
+ metadata.gz: e703a9c19bbe0247b85fc02107f7877c52c04dbbe058b2a8f27e926f3d5261e3
4
+ data.tar.gz: '04958635d3712700bf351335d8356ff17408fbe73b6b9342e1e0e837deb3f40e'
5
5
  SHA512:
6
- metadata.gz: c0005c9f1ae41149009d37a7c18fc795e0957a437b40d9f80efa13cd4504317ef3e34524f47d79eb91b2a23fc23575af2e337dbe5f6c110fd3bfc30895fc57e3
7
- data.tar.gz: 13a49be5a1cbde27fd6986b6e05af2937cc3ee5bb8961d33d7246850596a52422d738a09bdb7adff6c07f68e923157e6058e2c5e0c95714db50dfa2c00a5b840
6
+ metadata.gz: c21165db27b4db383b702d87eda5b3199eedf61f51189b9ce22c25b7b8393a60280d1c2f0cd41e10390aede1d5b8ca3e4c7273a02853ac2be8c6fdefc60bc848
7
+ data.tar.gz: 6a5b41fb281ecd34217a0c9205e7446ee945cf24b0870287f012a8ed0724f887c99c301f6cea549112de61911ca7d7121f85a3ae8fe70e8cebe825c35250f452
@@ -45,7 +45,7 @@ module Baykit
45
45
  def initialize(agt, anchorable)
46
46
  super(agt)
47
47
  @anchorable = anchorable
48
- @operations = []
48
+ @operations = {}
49
49
  @operations_lock = Mutex.new
50
50
 
51
51
  begin
@@ -272,19 +272,18 @@ module Baykit
272
272
  def add_operation(rd, op, to_connect=false)
273
273
  @operations_lock.synchronize do
274
274
  found = false
275
- @operations.each do |ch_op|
276
- if ch_op.rudder == rd
277
- ch_op.op |= op
278
- ch_op.to_connect = (ch_op.to_connect or to_connect)
279
- found = true
280
- BayLog.trace("%s Update operation: %s con=%s ch=%s",
281
- @agent, self.class.op_mode(ch_op.op), ch_op.to_connect, ch_op.rudder.inspect())
282
- end
275
+ ch_op = @operations[rd]
276
+ if ch_op != nil
277
+ ch_op.op |= op
278
+ ch_op.to_connect = (ch_op.to_connect or to_connect)
279
+ found = true
280
+ #BayLog.debug("%s Update operation: %d con=%s rd=%s",
281
+ # @agent, self.class.op_mode(ch_op.op), ch_op.to_connect, rd)
283
282
  end
284
283
 
285
284
  if not found
286
- BayLog.trace("%s New operation: %d con=%s close=%s ch=%s", @agent, op, to_connect, rd.inspect)
287
- @operations << ChannelOperation.new(rd, op, to_connect)
285
+ #BayLog.debug("%s New operation: %d con=%s close=%s rd=%s", @agent, op, to_connect, rd)
286
+ @operations[rd] =ChannelOperation.new(rd, op, to_connect)
288
287
  end
289
288
  end
290
289
 
@@ -298,16 +297,16 @@ module Baykit
298
297
 
299
298
  @operations_lock.synchronize do
300
299
  nch = @operations.length
301
- @operations.each do |rd_op|
302
- st = get_rudder_state(rd_op.rudder)
303
- if rd_op.rudder.io.closed?
300
+ @operations.each do |rd, rd_op|
301
+ st = get_rudder_state(rd)
302
+ if rd.io.closed?
304
303
  # Channel is closed before register operation
305
304
  BayLog.debug("%s Try to register closed socket (Ignore)", @agent)
306
305
  next
307
306
  end
308
307
 
309
308
  begin
310
- io = rd_op.rudder.io
309
+ io = rd.io
311
310
  BayLog.trace("%s register op=%s st=%s", @agent, self.class.op_mode(rd_op.op), st)
312
311
  op = @selector.get_op(io)
313
312
  if op == nil
@@ -328,7 +327,7 @@ module Baykit
328
327
  end
329
328
 
330
329
  rescue => e
331
- st = get_rudder_state(rd_op.rudder)
330
+ st = get_rudder_state(rd)
332
331
  BayLog.error_e(e, "%s Cannot register operation: %s", self.agent, st.rudder)
333
332
  end
334
333
  end
@@ -208,22 +208,8 @@ module Baykit
208
208
  if !tur.valid?
209
209
  raise Sink.new("Tour is not valid")
210
210
  end
211
- keep_alive = false
212
- if tur.req.headers.get_connection() == Headers::CONNECTION_KEEP_ALIVE
213
- keep_alive = true
214
- if keep_alive
215
- res_conn = tur.res.headers.get_connection()
216
- keep_alive = (res_conn == Headers::CONNECTION_KEEP_ALIVE) ||
217
- (res_conn == Headers::CONNECTION_UNKNOWN)
218
- end
219
- if keep_alive
220
- if tur.res.headers.content_length() < 0
221
- keep_alive = false
222
- end
223
- end
224
- end
225
211
 
226
- tour_handler.send_end_tour(tur, keep_alive, &callback)
212
+ tour_handler.send_end_tour(tur, &callback)
227
213
  end
228
214
  end
229
215
 
@@ -47,7 +47,7 @@ module Baykit
47
47
  now = Time.now.to_i
48
48
 
49
49
  if file_content.loaded_time + @lifespan_seconds < Time.now.to_i
50
- @total_bytes -= file_content.length
50
+ @total_bytes -= file_content.content_length
51
51
  BayLog.debug("Remove expired content: %s", path)
52
52
  @contents.delete(path)
53
53
  file_content = nil
@@ -68,9 +68,10 @@ module Baykit
68
68
  end
69
69
 
70
70
  def get_byte
71
- buf = StringUtil.alloc(1)
72
- get_bytes(buf, 0, 1)
73
- buf[0].codepoints[0]
71
+ check_read(1)
72
+ b = @packet.buf[@start + @pos]
73
+ @pos += 1
74
+ return b.codepoints[0]
74
75
  end
75
76
 
76
77
  def get_bytes(buf, ofs=0, len=buf.length)
@@ -21,7 +21,7 @@ module Baykit
21
21
  end
22
22
 
23
23
  # Send end of contents to client.
24
- def send_end_tour(tur, keep_alive, &lis)
24
+ def send_end_tour(tur, &lis)
25
25
  raise NotImplementedError.new
26
26
  end
27
27
 
@@ -18,9 +18,7 @@ module Baykit
18
18
  end
19
19
 
20
20
  def IOUtil.write_int32(io, i)
21
- data = [i >> 24, i >> 16 & 0xFF, i >> 8 & 0xFF, i & 0xFF]
22
- #print("IOwrite->" + data.to_s)
23
- io.write(data.pack("C*"))
21
+ io.write([i].pack("N"))
24
22
  end
25
23
 
26
24
  def IOUtil.get_sock_recv_buf_size(skt)
@@ -5,8 +5,11 @@ module Baykit
5
5
  #
6
6
  # interface
7
7
  #
8
- # create_object()
9
- #
8
+
9
+ def create_object()
10
+ raise "Not implemented"
11
+ end
12
+
10
13
  end
11
14
  end
12
15
  end
@@ -10,8 +10,8 @@ module Baykit
10
10
  attr :factory
11
11
 
12
12
  def initialize(factory=nil)
13
- @free_list = []
14
- @active_list = []
13
+ @free_list = {}
14
+ @active_list = {}
15
15
  @factory = factory
16
16
  end
17
17
 
@@ -34,12 +34,12 @@ module Baykit
34
34
  obj = @factory.call()
35
35
  end
36
36
  else
37
- obj = @free_list.delete_at(@free_list.length - 1)
37
+ obj = @free_list.shift()[0]
38
38
  end
39
39
  if obj == nil
40
40
  raise Sink.new()
41
41
  end
42
- @active_list.append(obj)
42
+ @active_list[obj] = true
43
43
  return obj
44
44
  end
45
45
 
@@ -54,7 +54,7 @@ module Baykit
54
54
 
55
55
  @active_list.delete(obj)
56
56
  if reuse
57
- @free_list.append(obj)
57
+ @free_list[obj] = true
58
58
  obj.reset()
59
59
  end
60
60
  end
@@ -5,8 +5,9 @@ module Baykit
5
5
  #
6
6
  # interface
7
7
  #
8
- # reset()
9
- #
8
+ def reset()
9
+ raise "Not implemented"
10
+ end
10
11
  end
11
12
  end
12
13
  end
@@ -37,9 +37,7 @@ module Baykit
37
37
  extend_buf
38
38
  end
39
39
 
40
- len.times do |i|
41
- @buf[@length + i] = bytes[pos + i]
42
- end
40
+ @buf[@length, len] = bytes[pos, len]
43
41
  @length += len
44
42
  end
45
43
 
@@ -1,7 +1,7 @@
1
1
  module Baykit
2
2
  module BayServer
3
3
  class Version
4
- VERSION='3.3.1'
4
+ VERSION='3.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: 3.3.1
4
+ version: 3.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: 2026-02-01 00:00:00.000000000 Z
11
+ date: 2026-02-02 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