yahns.git  about / heads / tags
sleepy, multi-threaded, non-blocking application server for Ruby
blob 997465b5c74e7f430cefb80ab5798806bf3ba1bd 517 bytes (raw)
$ git show maint:lib/yahns/openssl_server.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
# Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
# frozen_string_literal: true

require_relative 'acceptor'
require_relative 'openssl_client'

class Yahns::OpenSSLServer < Kgio::TCPServer # :nodoc:
  include Yahns::Acceptor

  def self.wrap(fd, ssl_ctx)
    srv = for_fd(fd)
    srv.instance_variable_set(:@ssl_ctx, ssl_ctx)
    srv
  end

  def kgio_accept(klass, flags)
    io = super
    io.yahns_init_ssl(@ssl_ctx)
    io
  end
end

git clone git://yhbt.net/yahns.git
git clone https://yhbt.net/yahns.git