rims 0.2.4 → 0.2.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.
@@ -50,11 +50,16 @@ module RIMS
50
50
  def scan_line(line)
51
51
  atom_list = line.scan(/BODY(?:\.\S+)?\[.*?\](?:<\d+\.\d+>)?|[\[\]()]|".*?"|[^\[\]()\s]+/i).map{|s|
52
52
  case (s)
53
- when '(', ')', '[', ']', /\ANIL\z/i
53
+ when '(', ')', '[', ']', /\A NIL \z/ix
54
54
  s.upcase.intern
55
- when /\A"/
56
- s.sub(/\A"/, '').sub(/"\z/, '')
57
- when /\A(?<body_symbol>BODY)(?:\.(?<body_option>\S+))?\[(?<body_section>.*)\](?:<(?<partial_origin>\d+\.(?<partial_size>\d+)>))?\z/i
55
+ when /\A "/x
56
+ s.sub(/\A "/x, '').sub(/" \z/x, '')
57
+ when /
58
+ \A
59
+ (?<body_symbol>BODY) (?:\. (?<body_option>\S+))? \[ (?<body_section>.*) \]
60
+ (?:< (?<partial_origin>\d+) \. (?<partial_size>\d+) >)?
61
+ \z
62
+ /ix
58
63
  body_symbol = $~[:body_symbol]
59
64
  body_option = $~[:body_option]
60
65
  body_section = $~[:body_section]
@@ -71,7 +76,7 @@ module RIMS
71
76
  s
72
77
  end
73
78
  }
74
- if ((atom_list[-1].is_a? String) && (atom_list[-1] =~ /\A{\d+}\z/)) then
79
+ if ((atom_list[-1].is_a? String) && (atom_list[-1] =~ /\A {\d+} \z/x)) then
75
80
  next_size = $&[1..-2].to_i
76
81
  @logger.debug("found literal: #{next_size} octets.") if @logger.debug?
77
82
  @output.write("+ continue\r\n")
@@ -107,7 +112,7 @@ module RIMS
107
112
  end
108
113
 
109
114
  if (atom == nil && last_atom != nil) then
110
- raise 'syntax error.'
115
+ raise SyntaxError, "not found a terminator: `#{last_atom}'"
111
116
  end
112
117
 
113
118
  syntax_list
@@ -121,7 +126,7 @@ module RIMS
121
126
  if (atom_list.length < 2) then
122
127
  raise 'need for tag and command.'
123
128
  end
124
- if (atom_list[0] =~ /\A[*+]/) then
129
+ if (atom_list[0] =~ /\A [*+]/x) then
125
130
  raise "invalid command tag: #{atom_list[0]}"
126
131
  end
127
132
  return parse(atom_list)
@@ -132,10 +137,10 @@ module RIMS
132
137
  end
133
138
 
134
139
  class AuthenticationReader
135
- def initialize(auth, input, output, logger)
140
+ def initialize(auth, input_gets, output_write, logger)
136
141
  @auth = auth
137
- @input = input
138
- @output = output
142
+ @input_gets = input_gets
143
+ @output_write = output_write
139
144
  @logger = logger
140
145
  end
141
146
 
@@ -168,15 +173,13 @@ module RIMS
168
173
  if (server_challenge_data) then
169
174
  server_challenge_data_base64 = Protocol.encode_base64(server_challenge_data)
170
175
  @logger.debug("authenticate command: server challenge data: #{Protocol.io_data_log(server_challenge_data_base64)}") if @logger.debug?
171
- @output.write("+ #{server_challenge_data_base64}\r\n")
172
- @output.flush
176
+ @output_write.call([ "+ #{server_challenge_data_base64}\r\n" ])
173
177
  else
174
178
  @logger.debug("authenticate command: server challenge data is nil.") if @logger.debug?
175
- @output.write("+ \r\n")
176
- @output.flush
179
+ @output_write.call([ "+ \r\n" ])
177
180
  end
178
181
 
179
- if (client_response_data_base64 = @input.gets) then
182
+ if (client_response_data_base64 = @input_gets.call) then
180
183
  client_response_data_base64.strip!
181
184
  @logger.debug("authenticate command: client response data: #{Protocol.io_data_log(client_response_data_base64)}") if @logger.debug?
182
185
  if (client_response_data_base64 == '*') then
@@ -326,7 +329,7 @@ module RIMS
326
329
  d = search_time.to_date
327
330
  proc{|next_cond|
328
331
  proc{|msg|
329
- yield(@mail_store.msg_date(@folder.mbox_id, msg.uid).to_date, d) && next_cond.call(msg)
332
+ yield(@mail_store.msg_date(@folder.mbox_id, msg.uid).utc.to_date, d) && next_cond.call(msg)
330
333
  }
331
334
  }
332
335
  end
@@ -337,7 +340,7 @@ module RIMS
337
340
  proc{|next_cond|
338
341
  proc{|msg|
339
342
  if (mail_datetime = get_mail(msg).date) then
340
- yield(mail_datetime.to_date, d) && next_cond.call(msg)
343
+ yield(mail_datetime.getutc.to_date, d) && next_cond.call(msg)
341
344
  else
342
345
  false
343
346
  end
@@ -418,12 +421,19 @@ module RIMS
418
421
  private :parse_or
419
422
 
420
423
  def parse_text(search_string)
421
- search = proc{|text| string_include?(search_string, text) }
424
+ search_text = proc{|message_text| string_include?(search_string, message_text) }
425
+ search_mail = proc{|mail|
426
+ if (mail.multipart?) then
427
+ search_text.call(mail.header.raw_source) || mail.parts.any?{|m| search_mail.call(m) }
428
+ else
429
+ body_text = mail_body_text(mail)
430
+ search_text.call(mail.header.raw_source) || (body_text && search_text.call(body_text))
431
+ end
432
+ }
422
433
  proc{|next_cond|
423
434
  proc{|msg|
424
435
  mail = get_mail(msg)
425
- body_txt = mail_body_text(mail)
426
- (search.call(mail.header.raw_source) || (body_txt && search.call(body_txt))) && next_cond.call(msg)
436
+ search_mail.call(mail) && next_cond.call(msg)
427
437
  }
428
438
  }
429
439
  end
@@ -494,7 +504,7 @@ module RIMS
494
504
  unless (octet_size_string = search_key.shift) then
495
505
  raise SyntaxError, "need for a octet size of #{operation_name}."
496
506
  end
497
- unless ((octet_size_string.is_a? String) && (octet_size_string =~ /\A\d+\z/)) then
507
+ unless ((octet_size_string.is_a? String) && (octet_size_string =~ /\A \d+ \z/x)) then
498
508
  raise SyntaxError, "#{operation_name} octet size is expected as numeric string but was <#{octet_size_string}>."
499
509
  end
500
510
 
@@ -650,26 +660,56 @@ module RIMS
650
660
 
651
661
  class FetchParser
652
662
  module Utils
663
+ def encode_value(object)
664
+ case (object)
665
+ when Symbol
666
+ object.to_s
667
+ when String
668
+ Protocol.quote(object)
669
+ when Integer
670
+ object.to_s
671
+ when NilClass
672
+ 'NIL'.b
673
+ when Array
674
+ '('.b << object.map{|v| encode_value(v) }.join(' '.b) << ')'.b
675
+ else
676
+ raise "unknown value: #{object}"
677
+ end
678
+ end
679
+ module_function :encode_value
680
+
653
681
  def encode_list(array)
654
- '('.b << array.map{|v|
655
- case (v)
656
- when Symbol
657
- v.to_s
658
- when String
659
- Protocol.quote(v)
660
- when Integer
661
- v.to_s
662
- when NilClass
663
- 'NIL'
664
- when Array
665
- encode_list(v)
666
- else
667
- raise "unknown value: #{v}"
668
- end
669
- }.join(' '.b) << ')'.b
682
+ unless (array.is_a? Array) then
683
+ raise TypeError, 'not a array type.'
684
+ end
685
+ encode_value(array)
670
686
  end
671
687
  module_function :encode_list
672
688
 
689
+ def encode_bodystructure(array)
690
+ if ((array.length > 0) && (array.first.is_a? Array)) then
691
+ s = '('.b
692
+ array = array.dup
693
+ while (object = array.shift)
694
+ case (object)
695
+ when Array
696
+ s << encode_bodystructure(object)
697
+ else
698
+ s << ' '.b << encode_value(object)
699
+ end
700
+ end
701
+ s << ')'.b
702
+ elsif ((array.length > 0) && (array.first.upcase == 'MESSAGE')) then
703
+ msg_body_list = array[0..7].map{|v| encode_value(v) }
704
+ msg_body_list << encode_bodystructure(array[8])
705
+ msg_body_list << array[9..-1].map{|v| encode_value(v) }
706
+ '('.b << msg_body_list.join(' '.b) << ')'.b
707
+ else
708
+ encode_list(array)
709
+ end
710
+ end
711
+ module_function :encode_bodystructure
712
+
673
713
  def encode_header(name_value_pair_list)
674
714
  name_value_pair_list.map{|n, v| ''.b << n << ': ' << v << "\r\n" }.join('') << "\r\n"
675
715
  end
@@ -886,7 +926,7 @@ module RIMS
886
926
  section_text = nil
887
927
  section_index_list = []
888
928
  else
889
- if (body.section_list[0] =~ /\A(?<index>\d+(?:\.\d+)*)(?:\.(?<text>.+))?\z/) then
929
+ if (body.section_list[0] =~ /\A (?<index>\d+(?:\.\d+)*) (?:\.(?<text>.+))? \z/x) then
890
930
  section_text = $~[:text]
891
931
  section_index_list = $~[:index].split(/\./).map{|i| i.to_i }
892
932
  else
@@ -996,7 +1036,7 @@ module RIMS
996
1036
 
997
1037
  def parse_bodystructure(msg_att_name)
998
1038
  proc{|msg|
999
- ''.b << msg_att_name << ' '.b << encode_list(get_bodystructure_data(get_mail(msg)))
1039
+ ''.b << msg_att_name << ' '.b << encode_bodystructure(get_bodystructure_data(get_mail(msg)))
1000
1040
  }
1001
1041
  end
1002
1042
  private :parse_bodystructure
@@ -25,9 +25,11 @@ module RIMS
25
25
 
26
26
  for _name, value in field_pair_list
27
27
  value.strip!
28
+ name.freeze
29
+ value.freeze
28
30
  end
29
31
 
30
- field_pair_list
32
+ field_pair_list.freeze
31
33
  end
32
34
  module_function :parse_header
33
35
 
@@ -46,12 +48,12 @@ module RIMS
46
48
  else
47
49
  value = $~[:token]
48
50
  end
49
- params[name.downcase] = [ name, value ]
51
+ params[name.downcase] = [ name.freeze, value.freeze ].freeze
50
52
  end
51
53
 
52
- [ main_type, sub_type, params ]
54
+ [ main_type.freeze, sub_type.freeze, params.freeze ].freeze
53
55
  else
54
- [ 'application', 'octet-stream', {} ]
56
+ [ 'application'.freeze, 'octet-stream'.freeze, {}.freeze ].freeze
55
57
  end
56
58
  end
57
59
  module_function :parse_content_type
@@ -68,12 +70,13 @@ module RIMS
68
70
  part_txt.lstrip!
69
71
  part_txt.chomp!("\n")
70
72
  part_txt.chomp!("\r")
73
+ part_txt.freeze
71
74
  end
72
- return part_list
75
+ return part_list.freeze
73
76
  end
74
77
  end
75
78
 
76
- []
79
+ [].freeze
77
80
  end
78
81
  module_function :parse_multipart_body
79
82
 
@@ -119,7 +122,7 @@ module RIMS
119
122
  end
120
123
  end
121
124
 
122
- dst_txt
125
+ dst_txt.freeze
123
126
  end
124
127
  module_function :unquote_phrase
125
128
 
@@ -138,9 +141,9 @@ module RIMS
138
141
  then
139
142
  display_name = $~[:display_name]
140
143
  group_list = $~[:group_list]
141
- addr_list << [ nil, nil, unquote_phrase(display_name), nil ]
144
+ addr_list << [ nil, nil, unquote_phrase(display_name), nil ].freeze
142
145
  addr_list.concat(parse_mail_address_list(group_list))
143
- addr_list << [ nil, nil, nil, nil ]
146
+ addr_list << [ nil, nil, nil, nil ].freeze
144
147
  elsif (src_txt.sub!(%r{
145
148
  \A
146
149
  \s*
@@ -149,7 +152,7 @@ module RIMS
149
152
  ,?
150
153
  }x, ''))
151
154
  then
152
- addr_list << [ nil, nil, $~[:local_part], $~[:domain] ]
155
+ addr_list << [ nil, nil, $~[:local_part].freeze, $~[:domain].freeze ].freeze
153
156
  elsif (src_txt.sub!(%r{
154
157
  \A
155
158
  \s*
@@ -174,13 +177,13 @@ module RIMS
174
177
  route = $~[:route]
175
178
  local_part = $~[:local_part]
176
179
  domain = $~[:domain]
177
- addr_list << [ unquote_phrase(display_name), route, local_part, domain ]
180
+ addr_list << [ unquote_phrase(display_name), route.freeze, local_part.freeze, domain.freeze ].freeze
178
181
  else
179
182
  break
180
183
  end
181
184
  end
182
185
 
183
- addr_list
186
+ addr_list.freeze
184
187
  end
185
188
  module_function :parse_mail_address_list
186
189
 
@@ -188,7 +191,7 @@ module RIMS
188
191
  include Enumerable
189
192
 
190
193
  def initialize(header_txt)
191
- @raw_source = header_txt
194
+ @raw_source = header_txt.freeze
192
195
  @field_list = nil
193
196
  @field_map = nil
194
197
  end
@@ -197,14 +200,17 @@ module RIMS
197
200
 
198
201
  def setup_header
199
202
  if (@field_list.nil? || @field_map.nil?) then
200
- @field_list = []
203
+ @field_list = RFC822.parse_header(@raw_source)
201
204
  @field_map = {}
202
- for name, value in RFC822.parse_header(@raw_source)
203
- @field_list << [ name, value ]
205
+ for name, value in @field_list
204
206
  key = name.downcase
205
207
  @field_map[key] = [] unless (@field_map.key? key)
206
208
  @field_map[key] << value
207
209
  end
210
+ @field_map.each_value do |value_list|
211
+ value_list.freeze
212
+ end
213
+ @field_map.freeze
208
214
  self
209
215
  end
210
216
  end
@@ -248,7 +254,7 @@ module RIMS
248
254
 
249
255
  class Body
250
256
  def initialize(body_txt)
251
- @raw_source = body_txt
257
+ @raw_source = body_txt.freeze
252
258
  end
253
259
 
254
260
  attr_reader :raw_source
@@ -256,7 +262,7 @@ module RIMS
256
262
 
257
263
  class Message
258
264
  def initialize(msg_txt)
259
- @raw_source = msg_txt
265
+ @raw_source = msg_txt.freeze
260
266
  @header = nil
261
267
  @body = nil
262
268
  @content_type = nil
@@ -356,12 +362,12 @@ module RIMS
356
362
  end
357
363
 
358
364
  def text?
359
- media_main_type.downcase == 'text'
365
+ media_main_type_upcase == 'TEXT'
360
366
  end
361
367
 
362
368
  def multipart?
363
369
  if (@is_multipart.nil?) then
364
- @is_multipart = (media_main_type.downcase == 'multipart')
370
+ @is_multipart = (media_main_type_upcase == 'MULTIPART')
365
371
  end
366
372
  @is_multipart
367
373
  end
@@ -371,9 +377,9 @@ module RIMS
371
377
  if (@parts.nil?) then
372
378
  if (boundary = self.boundary) then
373
379
  part_list = RFC822.parse_multipart_body(boundary, body.raw_source)
374
- @parts = part_list.map{|msg_txt| Message.new(msg_txt) }
380
+ @parts = part_list.map{|msg_txt| Message.new(msg_txt) }.freeze
375
381
  else
376
- @parts = []
382
+ @parts = [].freeze
377
383
  end
378
384
  end
379
385
  @parts
@@ -382,7 +388,7 @@ module RIMS
382
388
 
383
389
  def message?
384
390
  if (@is_message.nil?) then
385
- @is_message = (media_main_type.downcase == 'message')
391
+ @is_message = (media_main_type_upcase == 'MESSAGE')
386
392
  end
387
393
  @is_message
388
394
  end
@@ -406,7 +412,7 @@ module RIMS
406
412
  end
407
413
  end
408
414
 
409
- @date
415
+ @date.freeze
410
416
  end
411
417
  end
412
418
 
@@ -416,6 +422,7 @@ module RIMS
416
422
  addr_list = instance_variable_get(ivar_name)
417
423
  if (addr_list.nil?) then
418
424
  addr_list = header.field_value_list(field_name).map{|addr_list_str| RFC822.parse_mail_address_list(addr_list_str) }.inject(:+)
425
+ addr_list.freeze
419
426
  instance_variable_set(ivar_name, addr_list)
420
427
  end
421
428
  addr_list
@@ -130,6 +130,10 @@ module RIMS
130
130
  # port: 143
131
131
  # backlog: 64
132
132
  # accept_polling_timeout_seconds: 0.1
133
+ # process_num: 4
134
+ # process_queue_size: 20
135
+ # process_queue_polling_timeout_seconds: 0.1
136
+ # process_send_io_polling_timeout_seconds: 0.1
133
137
  # thread_num: 20
134
138
  # thread_queue_size: 20
135
139
  # thread_queue_polling_timeout_seconds: 0.1
@@ -153,10 +157,13 @@ module RIMS
153
157
  # send_buffer_limit_size: 16384
154
158
  # read_polling_interval_seconds: 1
155
159
  # command_wait_timeout_seconds: 1800
156
- # lock:
157
- # read_lock_timeout_seconds: 30
158
- # write_lock_timeout_seconds: 30
159
- # cleanup_write_lock_timeout_seconds: 1
160
+ # drb_services:
161
+ # process_num: 4
162
+ # engine:
163
+ # bulk_response_count: 100
164
+ # read_lock_timeout_seconds: 30
165
+ # write_lock_timeout_seconds: 30
166
+ # cleanup_write_lock_timeout_seconds: 1
160
167
  # storage:
161
168
  # meta_key_value_store:
162
169
  # type: qdbm_depot
@@ -455,20 +462,19 @@ module RIMS
455
462
  end
456
463
 
457
464
  def process_num
458
- # not yet supported multi-process server configuration.
459
- 0
465
+ @config.dig('server', 'process_num') || 0
460
466
  end
461
467
 
462
468
  def process_queue_size
463
- 20
469
+ @config.dig('server', 'process_queue_size') || 20
464
470
  end
465
471
 
466
472
  def process_queue_polling_timeout_seconds
467
- 0.1
473
+ @config.dig('server', 'process_queue_polling_timeout_seconds') || 0.1
468
474
  end
469
475
 
470
476
  def process_send_io_polling_timeout_seconds
471
- 0.1
477
+ @config.dig('server', 'process_send_io_polling_timeout_seconds') || 0.1
472
478
  end
473
479
 
474
480
  def thread_num
@@ -545,20 +551,28 @@ module RIMS
545
551
  @config.dig('connection', 'command_wait_timeout_seconds') || 60 * 30)
546
552
  end
547
553
 
554
+ def drb_process_num
555
+ @config.dig('drb_services', 'process_num') || 0
556
+ end
557
+
558
+ def bulk_response_count
559
+ @config.dig('drb_services', 'engine', 'bulk_response_count') || 100
560
+ end
561
+
548
562
  def read_lock_timeout_seconds
549
- @config.dig('lock', 'read_lock_timeout_seconds') ||
563
+ @config.dig('drb_services', 'engine', 'read_lock_timeout_seconds') ||
550
564
  @config.dig('read_lock_timeout_seconds') || # for backward compatibility
551
565
  30
552
566
  end
553
567
 
554
568
  def write_lock_timeout_seconds
555
- @config.dig('lock', 'write_lock_timeout_seconds') ||
569
+ @config.dig('drb_services', 'engine', 'write_lock_timeout_seconds') ||
556
570
  @config.dig('write_lock_timeout_seconds') || # for backward compatibility
557
571
  30
558
572
  end
559
573
 
560
574
  def cleanup_write_lock_timeout_seconds
561
- @config.dig('lock', 'cleanup_write_lock_timeout_seconds') ||
575
+ @config.dig('drb_services', 'engine', 'cleanup_write_lock_timeout_seconds') ||
562
576
  @config.dig('cleanup_write_lock_timeout_seconds') || # for backward compatibility
563
577
  1
564
578
  end
@@ -756,7 +770,32 @@ module RIMS
756
770
  kvs_meta_open, kvs_meta_log = make_kvs_factory.call(@config.make_meta_key_value_store_params, 'meta')
757
771
  kvs_text_open, kvs_text_log = make_kvs_factory.call(@config.make_text_key_value_store_params, 'text')
758
772
  auth = @config.make_authentication
759
- mail_store_pool = MailStore.build_pool(kvs_meta_open, kvs_text_open)
773
+
774
+ drb_process_num = @config.drb_process_num
775
+ if (@config.process_num > 0) then
776
+ unless (drb_process_num > 0) then
777
+ drb_process_num = 1
778
+ logger.warn('the number of dRuby processes needs to be 1 or more when the number of server processes is 1 or more.')
779
+ logger.warn("drb_services parameter: changed process_num: #{@config.drb_process_num} -> #{drb_process_num}")
780
+ end
781
+ end
782
+
783
+ services = Riser::DRbServices.new(drb_process_num)
784
+ services.add_sticky_process_service(:engine,
785
+ Riser::ResourceSet.build{|builder|
786
+ builder.at_create{|unique_user_id|
787
+ mail_store = MailStore.build(unique_user_id, kvs_meta_open, kvs_text_open)
788
+ Protocol::Decoder::Engine.new(unique_user_id, mail_store, logger,
789
+ bulk_response_count: @config.bulk_response_count,
790
+ read_lock_timeout_seconds: @config.read_lock_timeout_seconds,
791
+ write_lock_timeout_seconds: @config.write_lock_timeout_seconds,
792
+ cleanup_write_lock_timeout_seconds: @config.cleanup_write_lock_timeout_seconds)
793
+ }
794
+ builder.at_destroy{|engine|
795
+ engine.destroy
796
+ }
797
+ builder.alias_unref(:destroy)
798
+ })
760
799
 
761
800
  server.before_start{|server_socket|
762
801
  logger.info('start server.')
@@ -856,6 +895,8 @@ module RIMS
856
895
  logger.info("connection parameter: send_buffer_limit_size=#{@config.send_buffer_limit_size}")
857
896
  logger.info("connection parameter: read_polling_interval_seconds=#{conn_limits.read_polling_interval_seconds}")
858
897
  logger.info("connection parameter: command_wait_timeout_seconds=#{conn_limits.command_wait_timeout_seconds}")
898
+ logger.info("drb_services parameter: process_num=#{drb_process_num}")
899
+ logger.info("drb_services engine parameter: bulk_response_count=#{@config.bulk_response_count}")
859
900
  logger.info("lock parameter: read_lock_timeout_seconds=#{@config.read_lock_timeout_seconds}")
860
901
  logger.info("lock parameter: write_lock_timeout_seconds=#{@config.write_lock_timeout_seconds}")
861
902
  logger.info("lock parameter: cleanup_write_lock_timeout_seconds=#{@config.cleanup_write_lock_timeout_seconds}")
@@ -863,12 +904,18 @@ module RIMS
863
904
  kvs_text_log.call
864
905
  logger.info("authentication parameter: hostname=#{auth.hostname}")
865
906
  logger.info("authorization parameter: mail_delivery_user=#{@config.mail_delivery_user}")
907
+
908
+ logger.info('dRuby services: start server.')
909
+ services.start_server
910
+ }
911
+ server.at_fork{
912
+ logger.info('dRuby services: detach server.')
913
+ services.detach_server
866
914
  }
867
- # server.at_fork{}
868
915
  server.at_stop{|stop_state|
869
916
  case (stop_state)
870
917
  when :graceful
871
- logger.info('autologout mmediately.')
918
+ logger.info('autologout immediately.')
872
919
  conn_limits.command_wait_timeout_seconds = 0
873
920
  when :forced
874
921
  logger.info('forced shutdown.')
@@ -878,6 +925,8 @@ module RIMS
878
925
  logger.info("stat: #{info.to_json}")
879
926
  }
880
927
  server.preprocess{
928
+ logger.info('dRuby services: start client.')
929
+ services.start_client
881
930
  auth.start_plug_in(logger)
882
931
  }
883
932
  server.dispatch{|socket|
@@ -898,11 +947,7 @@ module RIMS
898
947
  stream = Riser::WriteBufferStream.new(socket, @config.send_buffer_limit_size)
899
948
  end
900
949
  stream = Riser::LoggingStream.new(stream, protocol_logger)
901
- decoder = Protocol::Decoder.new_decoder(mail_store_pool, auth, logger,
902
- mail_delivery_user: @config.mail_delivery_user,
903
- read_lock_timeout_seconds: @config.read_lock_timeout_seconds,
904
- write_lock_timeout_seconds: @config.write_lock_timeout_seconds,
905
- cleanup_write_lock_timeout_seconds: @config.cleanup_write_lock_timeout_seconds)
950
+ decoder = Protocol::Decoder.new_decoder(services, auth, logger, mail_delivery_user: @config.mail_delivery_user)
906
951
  Protocol::Decoder.repl(decoder, conn_limits, stream, stream, logger)
907
952
  ensure
908
953
  if (stream) then
@@ -934,6 +979,8 @@ module RIMS
934
979
  auth.stop_plug_in(logger)
935
980
  }
936
981
  server.after_stop{
982
+ logger.info('dRuby services: stop server.')
983
+ services.stop_server
937
984
  logger.info('stop server.')
938
985
  }
939
986