Class: DRb::DRbSSLSocket
| Relationships & Source Files | |
| Namespace Children | |
| Classes: | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: 
          self,
           DRbTCPSocket | |
| Instance Chain: 
          self,
           DRbTCPSocket | |
| Inherits: | DRb::DRbTCPSocket 
 | 
| Defined in: | lib/drb/ssl.rb | 
Overview
Class Method Summary
- 
    
      .new(uri, soc, config, is_established)  ⇒ DRbSSLSocket 
    
    constructor
    Create a DRbSSLSocketinstance.
- 
    
      .open(uri, config)  
    
    Return an DRbSSLSocketinstance as a client-side connection, with the SSL connected.
- 
    
      .open_server(uri, config)  
    
    Returns a DRbSSLSocketinstance as a server-side connection, with the SSL connected.
- 
    
      .parse_uri(uri)  
    
    Internal use only
    Parse the dRuby uri for an SSL connection. 
- .uri_option(uri, config) Internal use only
DRbTCPSocket - Inherited
| .getservername | Returns the hostname of this server. | 
| .new | Create a new  | 
| .open | |
| .open_server | |
| .open_server_inaddr_any | For the families available for  | 
| .uri_option | Parse uri into a [uri, option] pair. | 
| .parse_uri | |
Instance Attribute Summary
DRbTCPSocket - Inherited
Instance Method Summary
- #accept Internal use only
- 
    
      #close  
    
    Internal use only
    Closes the SSL stream before closing the dRuby connection. 
- 
    
      #stream  
    
    Internal use only
    Returns the SSL stream. 
DRbTCPSocket - Inherited
| #accept | On the server side, for an instance returned by  | 
| #close | Close the connection. | 
| #peeraddr | Get the address of our TCP peer (the other end of the socket we are bound to. | 
| #recv_reply | On the client side, receive a reply from the server. | 
| #recv_request | On the server side, receive a request from the client. | 
| #send_reply | On the server side, send a reply to the client. | 
| #send_request | On the client side, send a request to the server. | 
| #set_sockopt, | |
| #shutdown | Graceful shutdown. | 
| #stream | Get the socket. | 
| #accept_or_shutdown, #close_shutdown_pipe | |
Constructor Details
    .new(uri, soc, config, is_established)  ⇒ DRbSSLSocket 
  
Create a DRbSSLSocket instance.
DRb.uri is the URI we are connected to. soc is the tcp socket we are bound to. DRb.config is our configuration. Either a Hash or DRbSSLSocket::SSLConfig is_established is a boolean of whether soc is currently established
This is called automatically based on the ::DRb protocol.
Class Method Details
.open(uri, config)
Return an DRbSSLSocket instance as a client-side connection, with the SSL connected.  This is called from DRb.start_service or while connecting to a remote object:
DRb.start_service 'drbssl://localhost:0', front, configDRb.uri is the URI we are connected to, 'drbssl://localhost:0' above, DRb.config is our configuration.  Either a Hash or DRbSSLSocket::SSLConfig
.open_server(uri, config)
Returns a DRbSSLSocket instance as a server-side connection, with the SSL connected.  This is called from DRb.start_service or while connecting to a remote object:
DRb.start_service 'drbssl://localhost:0', front, configDRb.uri is the URI we are connected to, 'drbssl://localhost:0' above, DRb.config is our configuration.  Either a Hash or DRbSSLSocket::SSLConfig
# File 'lib/drb/ssl.rb', line 277
def self.open_server(uri, config) uri = 'drbssl://:0' unless uri host, port, = parse_uri(uri) if host.size == 0 host = getservername soc = open_server_inaddr_any(host, port) else soc = TCPServer.open(host, port) end port = soc.addr[1] if port == 0 @uri = "drbssl://#{host}:#{port}" ssl_conf = SSLConfig.new(config) ssl_conf.setup_certificate ssl_conf.setup_ssl_context self.new(@uri, soc, ssl_conf, false) end
.parse_uri(uri)
.uri_option(uri, config)
This is a convenience method to parse DRb.uri and separate out any additional options appended in the DRb.uri.
Returns an option-less uri and the option => [uri,option]
The DRb.config is completely unused, so passing nil is sufficient.
Instance Method Details
#accept
# File 'lib/drb/ssl.rb', line 331
def accept # :nodoc: begin while true soc = accept_or_shutdown return nil unless soc break if (@acl ? @acl.allow_socket?(soc) : true) soc.close end begin ssl = @config.accept(soc) rescue Exception soc.close raise end self.class.new(uri, ssl, @config, true) rescue OpenSSL::SSL::SSLError warn("#{$!.} (#{$!.class})", uplevel: 0) if @config[:verbose] retry end end
#close
Closes the SSL stream before closing the dRuby connection.
# File 'lib/drb/ssl.rb', line 323
def close # :nodoc: if @ssl @ssl.close @ssl = nil end super end
#stream
Returns the SSL stream
# File 'lib/drb/ssl.rb', line 320
def stream; @ssl; end # :nodoc: