summaryrefslogtreecommitdiff
path: root/ext/openssl/sample/echo_svr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/sample/echo_svr.rb')
-rw-r--r--ext/openssl/sample/echo_svr.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/openssl/sample/echo_svr.rb b/ext/openssl/sample/echo_svr.rb
index e35ad12a19a..be8e10fa26c 100644
--- a/ext/openssl/sample/echo_svr.rb
+++ b/ext/openssl/sample/echo_svr.rb
@@ -51,14 +51,12 @@ else
$stderr.puts "!!! WARNING: PEER CERTIFICATE WON'T BE VERIFIED !!!"
end
-svr = TCPServer.new(port)
+tcps = TCPServer.new(port)
+ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
loop do
- ns = svr.accept
- ssl = OpenSSL::SSL::SSLSocket.new(ns, ctx)
- ssl.accept
- while line = ssl.gets
- ssl.write line
+ ns = ssls.accept
+ while line = ns.gets
+ ns.write line
end
- ssl.close
ns.close
end