Class: OpenSSL::SSL::SSLServer
Instance Attribute Summary collapse
Instance Method Summary
collapse
#addr, #closed?, #do_not_reverse_lookup=, #fcntl, #getsockopt, #peeraddr, #setsockopt
Constructor Details
#initialize(svr, ctx) ⇒ SSLServer
Returns a new instance of SSLServer.
155
156
157
158
159
160
161
162
163
164
165
|
# File 'lib/openssl/ssl.rb', line 155
def initialize(svr, ctx)
@svr = svr
@ctx = ctx
unless ctx.session_id_context
prng = ::Random.new($0.hash)
session_id = prng.bytes(16).unpack('H*')[0]
@ctx.session_id_context = session_id
end
@start_immediately = true
end
|
Instance Attribute Details
Returns the value of attribute start_immediately.
153
154
155
|
# File 'lib/openssl/ssl.rb', line 153
def start_immediately
@start_immediately
end
|
Instance Method Details
#accept ⇒ Object
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/openssl/ssl.rb', line 179
def accept
sock = @svr.accept
begin
ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx)
ssl.sync_close = true
ssl.accept if @start_immediately
ssl
rescue SSLError => ex
sock.close
raise ex
end
end
|
#close ⇒ Object
192
193
194
|
# File 'lib/openssl/ssl.rb', line 192
def close
@svr.close
end
|
#listen(backlog = 5) ⇒ Object
171
172
173
|
# File 'lib/openssl/ssl.rb', line 171
def listen(backlog=5)
@svr.listen(backlog)
end
|
#shutdown(how = Socket::SHUT_RDWR) ⇒ Object
175
176
177
|
# File 'lib/openssl/ssl.rb', line 175
def shutdown(how=Socket::SHUT_RDWR)
@svr.shutdown(how)
end
|
#to_io ⇒ Object
167
168
169
|
# File 'lib/openssl/ssl.rb', line 167
def to_io
@svr
end
|