rubysl-drb 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +8 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +25 -0
  6. data/README.md +29 -0
  7. data/Rakefile +1 -0
  8. data/lib/drb.rb +1 -0
  9. data/lib/drb/acl.rb +146 -0
  10. data/lib/drb/drb.rb +1783 -0
  11. data/lib/drb/eq.rb +16 -0
  12. data/lib/drb/extserv.rb +64 -0
  13. data/lib/drb/extservm.rb +89 -0
  14. data/lib/drb/gw.rb +122 -0
  15. data/lib/drb/invokemethod.rb +34 -0
  16. data/lib/drb/observer.rb +22 -0
  17. data/lib/drb/ssl.rb +190 -0
  18. data/lib/drb/timeridconv.rb +91 -0
  19. data/lib/drb/unix.rb +108 -0
  20. data/lib/rubysl/drb.rb +2 -0
  21. data/lib/rubysl/drb/drb.rb +2 -0
  22. data/lib/rubysl/drb/version.rb +5 -0
  23. data/rubysl-drb.gemspec +23 -0
  24. data/spec/config_spec.rb +4 -0
  25. data/spec/current_server_spec.rb +4 -0
  26. data/spec/drbarray/_dump_spec.rb +6 -0
  27. data/spec/drbarray/_load_spec.rb +6 -0
  28. data/spec/drbconn/alive_spec.rb +6 -0
  29. data/spec/drbconn/close_spec.rb +6 -0
  30. data/spec/drbconn/open_spec.rb +6 -0
  31. data/spec/drbconn/send_message_spec.rb +6 -0
  32. data/spec/drbconn/uri_spec.rb +6 -0
  33. data/spec/drbidconv/to_id_spec.rb +6 -0
  34. data/spec/drbidconv/to_obj_spec.rb +6 -0
  35. data/spec/drbmessage/dump_spec.rb +6 -0
  36. data/spec/drbmessage/load_spec.rb +6 -0
  37. data/spec/drbmessage/recv_reply_spec.rb +6 -0
  38. data/spec/drbmessage/recv_request_spec.rb +6 -0
  39. data/spec/drbmessage/send_reply_spec.rb +6 -0
  40. data/spec/drbmessage/send_request_spec.rb +6 -0
  41. data/spec/drbobject/__drbref_spec.rb +4 -0
  42. data/spec/drbobject/__drburi_spec.rb +4 -0
  43. data/spec/drbobject/_dump_spec.rb +4 -0
  44. data/spec/drbobject/_load_spec.rb +4 -0
  45. data/spec/drbobject/eql_spec.rb +4 -0
  46. data/spec/drbobject/equal_value_spec.rb +4 -0
  47. data/spec/drbobject/hash_spec.rb +4 -0
  48. data/spec/drbobject/method_missing_spec.rb +4 -0
  49. data/spec/drbobject/new_spec.rb +0 -0
  50. data/spec/drbobject/new_with_spec.rb +4 -0
  51. data/spec/drbobject/new_with_uri_spec.rb +4 -0
  52. data/spec/drbobject/prepare_backtrace_spec.rb +4 -0
  53. data/spec/drbobject/pretty_print_cycle_spec.rb +4 -0
  54. data/spec/drbobject/pretty_print_spec.rb +4 -0
  55. data/spec/drbobject/respond_to_spec.rb +4 -0
  56. data/spec/drbobject/with_friend_spec.rb +4 -0
  57. data/spec/drbprotocol/add_protocol_spec.rb +6 -0
  58. data/spec/drbprotocol/auto_load_spec.rb +6 -0
  59. data/spec/drbprotocol/open_server_spec.rb +6 -0
  60. data/spec/drbprotocol/open_spec.rb +6 -0
  61. data/spec/drbprotocol/uri_option_spec.rb +6 -0
  62. data/spec/drbserver/alive_spec.rb +6 -0
  63. data/spec/drbserver/check_insecure_method_spec.rb +6 -0
  64. data/spec/drbserver/config_spec.rb +6 -0
  65. data/spec/drbserver/default_acl_spec.rb +6 -0
  66. data/spec/drbserver/default_argc_limit_spec.rb +6 -0
  67. data/spec/drbserver/default_id_conv_spec.rb +6 -0
  68. data/spec/drbserver/default_load_limit_spec.rb +6 -0
  69. data/spec/drbserver/default_safe_level_spec.rb +6 -0
  70. data/spec/drbserver/front_spec.rb +6 -0
  71. data/spec/drbserver/invokemethod/perform_spec.rb +6 -0
  72. data/spec/drbserver/invokemethod18mixin/block_yield_spec.rb +6 -0
  73. data/spec/drbserver/invokemethod18mixin/perform_with_block_spec.rb +6 -0
  74. data/spec/drbserver/make_config_spec.rb +6 -0
  75. data/spec/drbserver/safe_level_spec.rb +6 -0
  76. data/spec/drbserver/stop_service_spec.rb +6 -0
  77. data/spec/drbserver/thread_spec.rb +6 -0
  78. data/spec/drbserver/to_id_spec.rb +6 -0
  79. data/spec/drbserver/to_obj_spec.rb +6 -0
  80. data/spec/drbserver/uri_spec.rb +6 -0
  81. data/spec/drbserver/verbose_spec.rb +18 -0
  82. data/spec/drbtcpsocket/accept_spec.rb +6 -0
  83. data/spec/drbtcpsocket/alive_spec.rb +6 -0
  84. data/spec/drbtcpsocket/close_spec.rb +6 -0
  85. data/spec/drbtcpsocket/getservername_spec.rb +6 -0
  86. data/spec/drbtcpsocket/open_server_inaddr_any_spec.rb +6 -0
  87. data/spec/drbtcpsocket/open_server_spec.rb +6 -0
  88. data/spec/drbtcpsocket/open_spec.rb +6 -0
  89. data/spec/drbtcpsocket/parse_uri_spec.rb +6 -0
  90. data/spec/drbtcpsocket/peeraddr_spec.rb +6 -0
  91. data/spec/drbtcpsocket/recv_reply_spec.rb +6 -0
  92. data/spec/drbtcpsocket/recv_request_spec.rb +6 -0
  93. data/spec/drbtcpsocket/send_reply_spec.rb +6 -0
  94. data/spec/drbtcpsocket/send_request_spec.rb +6 -0
  95. data/spec/drbtcpsocket/set_sockopt_spec.rb +6 -0
  96. data/spec/drbtcpsocket/stream_spec.rb +6 -0
  97. data/spec/drbtcpsocket/uri_option_spec.rb +6 -0
  98. data/spec/drbtcpsocket/uri_spec.rb +6 -0
  99. data/spec/drbundumped/_dump_spec.rb +6 -0
  100. data/spec/drbunknown/_dump_spec.rb +6 -0
  101. data/spec/drbunknown/_load_spec.rb +6 -0
  102. data/spec/drbunknown/buf_spec.rb +6 -0
  103. data/spec/drbunknown/exception_spec.rb +6 -0
  104. data/spec/drbunknown/name_spec.rb +6 -0
  105. data/spec/drbunknown/reload_spec.rb +6 -0
  106. data/spec/drburioption/eql_spec.rb +6 -0
  107. data/spec/drburioption/equal_value_spec.rb +6 -0
  108. data/spec/drburioption/hash_spec.rb +6 -0
  109. data/spec/drburioption/option_spec.rb +6 -0
  110. data/spec/drburioption/to_s_spec.rb +6 -0
  111. data/spec/exception/_dump_spec.rb +6 -0
  112. data/spec/exception/_load_spec.rb +6 -0
  113. data/spec/exception/reason_spec.rb +6 -0
  114. data/spec/exception/unknown_spec.rb +6 -0
  115. data/spec/fetch_server_spec.rb +4 -0
  116. data/spec/fixtures/test_server.rb +8 -0
  117. data/spec/front_spec.rb +4 -0
  118. data/spec/here_spec.rb +4 -0
  119. data/spec/install_acl_spec.rb +4 -0
  120. data/spec/install_id_conv_spec.rb +4 -0
  121. data/spec/mutex_spec.rb +6 -0
  122. data/spec/primary_server_spec.rb +8 -0
  123. data/spec/regist_server_spec.rb +4 -0
  124. data/spec/remove_server_spec.rb +4 -0
  125. data/spec/start_service_spec.rb +36 -0
  126. data/spec/stop_service_spec.rb +24 -0
  127. data/spec/thread_spec.rb +4 -0
  128. data/spec/to_id_spec.rb +4 -0
  129. data/spec/to_obj_spec.rb +4 -0
  130. data/spec/uri_spec.rb +4 -0
  131. metadata +336 -0
data/lib/drb/eq.rb ADDED
@@ -0,0 +1,16 @@
1
+ require 'drb/drb'
2
+
3
+ module DRb
4
+ class DRbObject
5
+ def ==(other)
6
+ return false unless DRbObject === other
7
+ (@ref == other.__drbref) && (@uri == other.__drburi)
8
+ end
9
+
10
+ def hash
11
+ [@uri, @ref].hash
12
+ end
13
+
14
+ alias eql? ==
15
+ end
16
+ end
@@ -0,0 +1,64 @@
1
+ =begin
2
+ external service
3
+ Copyright (c) 2000,2002 Masatoshi SEKI
4
+ =end
5
+
6
+ require 'drb/drb'
7
+
8
+ module DRb
9
+ class ExtServ
10
+ include DRbUndumped
11
+
12
+ def initialize(there, name, server=nil)
13
+ @server = server || DRb::primary_server
14
+ @name = name
15
+ ro = DRbObject.new(nil, there)
16
+ @invoker = ro.regist(name, DRbObject.new(self, @server.uri))
17
+ end
18
+ attr_reader :server
19
+
20
+ def front
21
+ DRbObject.new(nil, @server.uri)
22
+ end
23
+
24
+ def stop_service
25
+ @invoker.unregist(@name)
26
+ server = @server
27
+ @server = nil
28
+ server.stop_service
29
+ true
30
+ end
31
+
32
+ def alive?
33
+ @server ? @server.alive? : false
34
+ end
35
+ end
36
+ end
37
+
38
+ if __FILE__ == $0
39
+ class Foo
40
+ include DRbUndumped
41
+
42
+ def initialize(str)
43
+ @str = str
44
+ end
45
+
46
+ def hello(it)
47
+ "#{it}: #{self}"
48
+ end
49
+
50
+ def to_s
51
+ @str
52
+ end
53
+ end
54
+
55
+ cmd = ARGV.shift
56
+ case cmd
57
+ when 'itest1', 'itest2'
58
+ front = Foo.new(cmd)
59
+ manager = DRb::DRbServer.new(nil, front)
60
+ es = DRb::ExtServ.new(ARGV.shift, ARGV.shift, manager)
61
+ es.server.thread.join
62
+ end
63
+ end
64
+
@@ -0,0 +1,89 @@
1
+ =begin
2
+ external service manager
3
+ Copyright (c) 2000 Masatoshi SEKI
4
+ =end
5
+
6
+ require 'drb/drb'
7
+ require 'thread'
8
+ require 'monitor'
9
+
10
+ module DRb
11
+ class ExtServManager
12
+ include DRbUndumped
13
+ include MonitorMixin
14
+
15
+ @@command = {}
16
+
17
+ def self.command
18
+ @@command
19
+ end
20
+
21
+ def self.command=(cmd)
22
+ @@command = cmd
23
+ end
24
+
25
+ def initialize
26
+ super()
27
+ @cond = new_cond
28
+ @servers = {}
29
+ @waiting = []
30
+ @queue = Queue.new
31
+ @thread = invoke_thread
32
+ @uri = nil
33
+ end
34
+ attr_accessor :uri
35
+
36
+ def service(name)
37
+ synchronize do
38
+ while true
39
+ server = @servers[name]
40
+ return server if server && server.alive?
41
+ invoke_service(name)
42
+ @cond.wait
43
+ end
44
+ end
45
+ end
46
+
47
+ def regist(name, ro)
48
+ synchronize do
49
+ @servers[name] = ro
50
+ @cond.signal
51
+ end
52
+ self
53
+ end
54
+
55
+ def unregist(name)
56
+ synchronize do
57
+ @servers.delete(name)
58
+ end
59
+ end
60
+
61
+ private
62
+ def invoke_thread
63
+ Thread.new do
64
+ while true
65
+ name = @queue.pop
66
+ invoke_service_command(name, @@command[name])
67
+ end
68
+ end
69
+ end
70
+
71
+ def invoke_service(name)
72
+ @queue.push(name)
73
+ end
74
+
75
+ def invoke_service_command(name, command)
76
+ raise "invalid command. name: #{name}" unless command
77
+ synchronize do
78
+ return if @servers.include?(name)
79
+ @servers[name] = false
80
+ end
81
+ uri = @uri || DRb.uri
82
+ if RUBY_PLATFORM =~ /mswin32/ && /NT/ =~ ENV["OS"]
83
+ system(%Q'cmd /c start "ruby" /b #{command} #{uri} #{name}')
84
+ else
85
+ system("#{command} #{uri} #{name} &")
86
+ end
87
+ end
88
+ end
89
+ end
data/lib/drb/gw.rb ADDED
@@ -0,0 +1,122 @@
1
+ require 'drb/drb'
2
+ require 'monitor'
3
+
4
+ module DRb
5
+ class GWIdConv < DRbIdConv
6
+ def to_obj(ref)
7
+ if Array === ref && ref[0] == :DRbObject
8
+ return DRbObject.new_with(ref[1], ref[2])
9
+ end
10
+ super(ref)
11
+ end
12
+ end
13
+
14
+ class GW
15
+ include MonitorMixin
16
+ def initialize
17
+ super()
18
+ @hash = {}
19
+ end
20
+
21
+ def [](key)
22
+ synchronize do
23
+ @hash[key]
24
+ end
25
+ end
26
+
27
+ def []=(key, v)
28
+ synchronize do
29
+ @hash[key] = v
30
+ end
31
+ end
32
+ end
33
+
34
+ class DRbObject
35
+ def self._load(s)
36
+ uri, ref = Marshal.load(s)
37
+ if DRb.uri == uri
38
+ return ref ? DRb.to_obj(ref) : DRb.front
39
+ end
40
+
41
+ self.new_with(DRb.uri, [:DRbObject, uri, ref])
42
+ end
43
+
44
+ def _dump(lv)
45
+ if DRb.uri == @uri
46
+ if Array === @ref && @ref[0] == :DRbObject
47
+ Marshal.dump([@ref[1], @ref[2]])
48
+ else
49
+ Marshal.dump([@uri, @ref]) # ??
50
+ end
51
+ else
52
+ Marshal.dump([DRb.uri, [:DRbObject, @uri, @ref]])
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ =begin
59
+ DRb.install_id_conv(DRb::GWIdConv.new)
60
+
61
+ front = DRb::GW.new
62
+
63
+ s1 = DRb::DRbServer.new('drbunix:/tmp/gw_b_a', front)
64
+ s2 = DRb::DRbServer.new('drbunix:/tmp/gw_b_c', front)
65
+
66
+ s1.thread.join
67
+ s2.thread.join
68
+ =end
69
+
70
+ =begin
71
+ # foo.rb
72
+
73
+ require 'drb/drb'
74
+
75
+ class Foo
76
+ include DRbUndumped
77
+ def initialize(name, peer=nil)
78
+ @name = name
79
+ @peer = peer
80
+ end
81
+
82
+ def ping(obj)
83
+ puts "#{@name}: ping: #{obj.inspect}"
84
+ @peer.ping(self) if @peer
85
+ end
86
+ end
87
+ =end
88
+
89
+ =begin
90
+ # gw_a.rb
91
+ require 'drb/unix'
92
+ require 'foo'
93
+
94
+ obj = Foo.new('a')
95
+ DRb.start_service("drbunix:/tmp/gw_a", obj)
96
+
97
+ robj = DRbObject.new_with_uri('drbunix:/tmp/gw_b_a')
98
+ robj[:a] = obj
99
+
100
+ DRb.thread.join
101
+ =end
102
+
103
+ =begin
104
+ # gw_c.rb
105
+ require 'drb/unix'
106
+ require 'foo'
107
+
108
+ foo = Foo.new('c', nil)
109
+
110
+ DRb.start_service("drbunix:/tmp/gw_c", nil)
111
+
112
+ robj = DRbObject.new_with_uri("drbunix:/tmp/gw_b_c")
113
+
114
+ puts "c->b"
115
+ a = robj[:a]
116
+ sleep 2
117
+
118
+ a.ping(foo)
119
+
120
+ DRb.thread.join
121
+ =end
122
+
@@ -0,0 +1,34 @@
1
+ # for ruby-1.8.0
2
+
3
+ module DRb
4
+ class DRbServer
5
+ module InvokeMethod18Mixin
6
+ def block_yield(x)
7
+ if x.size == 1 && x[0].class == Array
8
+ x[0] = DRbArray.new(x[0])
9
+ end
10
+ block_value = @block.call(*x)
11
+ end
12
+
13
+ def perform_with_block
14
+ @obj.__send__(@msg_id, *@argv) do |*x|
15
+ jump_error = nil
16
+ begin
17
+ block_value = block_yield(x)
18
+ rescue LocalJumpError
19
+ jump_error = $!
20
+ end
21
+ if jump_error
22
+ case jump_error.reason
23
+ when :break
24
+ break(jump_error.exit_value)
25
+ else
26
+ raise jump_error
27
+ end
28
+ end
29
+ block_value
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,22 @@
1
+ require 'observer'
2
+
3
+ module DRb
4
+ module DRbObservable
5
+ include Observable
6
+
7
+ def notify_observers(*arg)
8
+ if defined? @observer_state and @observer_state
9
+ if defined? @observer_peers
10
+ for i in @observer_peers.dup
11
+ begin
12
+ i.update(*arg)
13
+ rescue
14
+ delete_observer(i)
15
+ end
16
+ end
17
+ end
18
+ @observer_state = false
19
+ end
20
+ end
21
+ end
22
+ end
data/lib/drb/ssl.rb ADDED
@@ -0,0 +1,190 @@
1
+ require 'socket'
2
+ require 'openssl'
3
+ require 'drb/drb'
4
+ require 'singleton'
5
+
6
+ module DRb
7
+
8
+ class DRbSSLSocket < DRbTCPSocket
9
+
10
+ class SSLConfig
11
+
12
+ DEFAULT = {
13
+ :SSLCertificate => nil,
14
+ :SSLPrivateKey => nil,
15
+ :SSLClientCA => nil,
16
+ :SSLCACertificatePath => nil,
17
+ :SSLCACertificateFile => nil,
18
+ :SSLVerifyMode => ::OpenSSL::SSL::VERIFY_NONE,
19
+ :SSLVerifyDepth => nil,
20
+ :SSLVerifyCallback => nil, # custom verification
21
+ :SSLCertificateStore => nil,
22
+ # Must specify if you use auto generated certificate.
23
+ :SSLCertName => nil, # e.g. [["CN","fqdn.example.com"]]
24
+ :SSLCertComment => "Generated by Ruby/OpenSSL"
25
+ }
26
+
27
+ def initialize(config)
28
+ @config = config
29
+ @cert = config[:SSLCertificate]
30
+ @pkey = config[:SSLPrivateKey]
31
+ @ssl_ctx = nil
32
+ end
33
+
34
+ def [](key);
35
+ @config[key] || DEFAULT[key]
36
+ end
37
+
38
+ def connect(tcp)
39
+ ssl = ::OpenSSL::SSL::SSLSocket.new(tcp, @ssl_ctx)
40
+ ssl.sync = true
41
+ ssl.connect
42
+ ssl
43
+ end
44
+
45
+ def accept(tcp)
46
+ ssl = OpenSSL::SSL::SSLSocket.new(tcp, @ssl_ctx)
47
+ ssl.sync = true
48
+ ssl.accept
49
+ ssl
50
+ end
51
+
52
+ def setup_certificate
53
+ if @cert && @pkey
54
+ return
55
+ end
56
+
57
+ rsa = OpenSSL::PKey::RSA.new(512){|p, n|
58
+ next unless self[:verbose]
59
+ case p
60
+ when 0; $stderr.putc "." # BN_generate_prime
61
+ when 1; $stderr.putc "+" # BN_generate_prime
62
+ when 2; $stderr.putc "*" # searching good prime,
63
+ # n = #of try,
64
+ # but also data from BN_generate_prime
65
+ when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q,
66
+ # but also data from BN_generate_prime
67
+ else; $stderr.putc "*" # BN_generate_prime
68
+ end
69
+ }
70
+
71
+ cert = OpenSSL::X509::Certificate.new
72
+ cert.version = 3
73
+ cert.serial = 0
74
+ name = OpenSSL::X509::Name.new(self[:SSLCertName])
75
+ cert.subject = name
76
+ cert.issuer = name
77
+ cert.not_before = Time.now
78
+ cert.not_after = Time.now + (365*24*60*60)
79
+ cert.public_key = rsa.public_key
80
+
81
+ ef = OpenSSL::X509::ExtensionFactory.new(nil,cert)
82
+ cert.extensions = [
83
+ ef.create_extension("basicConstraints","CA:FALSE"),
84
+ ef.create_extension("subjectKeyIdentifier", "hash") ]
85
+ ef.issuer_certificate = cert
86
+ cert.add_extension(ef.create_extension("authorityKeyIdentifier",
87
+ "keyid:always,issuer:always"))
88
+ if comment = self[:SSLCertComment]
89
+ cert.add_extension(ef.create_extension("nsComment", comment))
90
+ end
91
+ cert.sign(rsa, OpenSSL::Digest::SHA1.new)
92
+
93
+ @cert = cert
94
+ @pkey = rsa
95
+ end
96
+
97
+ def setup_ssl_context
98
+ ctx = ::OpenSSL::SSL::SSLContext.new
99
+ ctx.cert = @cert
100
+ ctx.key = @pkey
101
+ ctx.client_ca = self[:SSLClientCA]
102
+ ctx.ca_path = self[:SSLCACertificatePath]
103
+ ctx.ca_file = self[:SSLCACertificateFile]
104
+ ctx.verify_mode = self[:SSLVerifyMode]
105
+ ctx.verify_depth = self[:SSLVerifyDepth]
106
+ ctx.verify_callback = self[:SSLVerifyCallback]
107
+ ctx.cert_store = self[:SSLCertificateStore]
108
+ @ssl_ctx = ctx
109
+ end
110
+ end
111
+
112
+ def self.parse_uri(uri)
113
+ if uri =~ /^drbssl:\/\/(.*?):(\d+)(\?(.*))?$/
114
+ host = $1
115
+ port = $2.to_i
116
+ option = $4
117
+ [host, port, option]
118
+ else
119
+ raise(DRbBadScheme, uri) unless uri =~ /^drbssl:/
120
+ raise(DRbBadURI, 'can\'t parse uri:' + uri)
121
+ end
122
+ end
123
+
124
+ def self.open(uri, config)
125
+ host, port, option = parse_uri(uri)
126
+ host.untaint
127
+ port.untaint
128
+ soc = TCPSocket.open(host, port)
129
+ ssl_conf = SSLConfig::new(config)
130
+ ssl_conf.setup_ssl_context
131
+ ssl = ssl_conf.connect(soc)
132
+ self.new(uri, ssl, ssl_conf, true)
133
+ end
134
+
135
+ def self.open_server(uri, config)
136
+ uri = 'drbssl://:0' unless uri
137
+ host, port, opt = parse_uri(uri)
138
+ if host.size == 0
139
+ host = getservername
140
+ soc = open_server_inaddr_any(host, port)
141
+ else
142
+ soc = TCPServer.open(host, port)
143
+ end
144
+ port = soc.addr[1] if port == 0
145
+ @uri = "drbssl://#{host}:#{port}"
146
+
147
+ ssl_conf = SSLConfig.new(config)
148
+ ssl_conf.setup_certificate
149
+ ssl_conf.setup_ssl_context
150
+ self.new(@uri, soc, ssl_conf, false)
151
+ end
152
+
153
+ def self.uri_option(uri, config)
154
+ host, port, option = parse_uri(uri)
155
+ return "drbssl://#{host}:#{port}", option
156
+ end
157
+
158
+ def initialize(uri, soc, config, is_established)
159
+ @ssl = is_established ? soc : nil
160
+ super(uri, soc.to_io, config)
161
+ end
162
+
163
+ def stream; @ssl; end
164
+
165
+ def close
166
+ if @ssl
167
+ @ssl.close
168
+ @ssl = nil
169
+ end
170
+ super
171
+ end
172
+
173
+ def accept
174
+ begin
175
+ while true
176
+ soc = @socket.accept
177
+ break if (@acl ? @acl.allow_socket?(soc) : true)
178
+ soc.close
179
+ end
180
+ ssl = @config.accept(soc)
181
+ self.class.new(uri, ssl, @config, true)
182
+ rescue OpenSSL::SSL::SSLError
183
+ warn("#{__FILE__}:#{__LINE__}: warning: #{$!.message} (#{$!.class})") if @config[:verbose]
184
+ retry
185
+ end
186
+ end
187
+ end
188
+
189
+ DRbProtocol.add_protocol(DRbSSLSocket)
190
+ end