Sha256: 7ad9a3dc1e78756245018342c2920dc527c3e1e2785ac062ff55ebb3d27a67e6

Contents?: true

Size: 965 Bytes

Versions: 13

Compression:

Stored size: 965 Bytes

Contents

module DeepTest
  class DRbBindAllTCPSocket < DRb::DRbTCPSocket
    def self.parse_uri(uri)
      if uri =~ /^drubyall:\/\/(.*?):(\d+)(\?(.*))?$/
      	host = $1
      	port = $2.to_i
      	option = $4
      	[host, port, option]
      else
      	raise(DRb::DRbBadScheme, uri) unless uri =~ /^drubyall:/
      	raise(DRb::DRbBadURI, 'can\'t parse uri:' + uri)
    	end
    end

    # Open a server listening for connections at +uri+ using 
    # configuration +config+.
    def self.open_server(uri, config)
      uri = 'drubyall://:0' unless uri
      host, port, opt = parse_uri(uri)

      if host.size == 0
        host = getservername
      end

      DeepTest.logger.debug("Listening on port #{port}, all addresses.")
	    soc = TCPServer.open('0.0.0.0', port)  	    
      port = soc.addr[1] if port == 0
      uri = "druby://#{host}:#{port}"
      self.new(uri, soc, config)
    end
  end
end

DRb::DRbProtocol.add_protocol DeepTest::DRbBindAllTCPSocket

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
jason-o-matic-deep_test-1.2.2.1 lib/deep_test/extensions/drb_extension.rb
jason-o-matic-deep_test-1.2.2.2 lib/deep_test/extensions/drb_extension.rb
jason-o-matic-deep_test-1.2.2.3 lib/deep_test/extensions/drb_extension.rb
jason-o-matic-deep_test-1.2.2.4 lib/deep_test/extensions/drb_extension.rb
jperkins-deep_test-1.2.2 lib/deep_test/extensions/drb_extension.rb
jstorimer-deep-test-1.4.0 lib/deep_test/extensions/drb_extension.rb
jstorimer-deep-test-1.3.0 lib/deep_test/extensions/drb_extension.rb
jstorimer-deep-test-1.2.0 lib/deep_test/extensions/drb_extension.rb
jstorimer-deep-test-1.1.0 lib/deep_test/extensions/drb_extension.rb
jstorimer-deep-test-1.0.0 lib/deep_test/extensions/drb_extension.rb
deep_test-1.2.0 lib/deep_test/extensions/drb_extension.rb
deep_test-1.2.2 lib/deep_test/extensions/drb_extension.rb
deep_test-1.2.1 lib/deep_test/extensions/drb_extension.rb