# DRb::DRbUNIXSocket (Class)

In: | drb/unix.rb
Parent: | DRbTCPSocket

## Methods

accept close new open open_server parse_uri set_sockopt uri_option

## Constants

Max_try | = | 10
| import from tempfile.rb

## Public Class methods

parse_uri(uri)

[Source]

    # File drb/unix.rb, line 10
        def self.parse_uri(uri)
          if /^drbunix:(.*?)(\?(.*))?$/ =~ uri
            filename = $1
            option = $3
            [filename, option]
          else
            raise(DRbBadScheme, uri) unless uri =~ /^drbunix:/
            raise(DRbBadURI, 'can\'t parse uri:' + uri)
          end
        end

open(uri, config)

[Source]

    # File drb/unix.rb, line 21
        def self.open(uri, config)
          filename, option = parse_uri(uri)
          filename.untaint
          soc = UNIXSocket.open(filename)
          self.new(uri, soc, config)
        end

open_server(uri, config)

[Source]

    # File drb/unix.rb, line 28
        def self.open_server(uri, config)
          filename, option = parse_uri(uri)
          if filename.size == 0
            soc = temp_server
            uri = 'drbunix:' + soc.path
          else
            soc = UNIXServer.open(filename)
          end
          owner = config[:UNIXFileOwner]
          group = config[:UNIXFileGroup]
          if owner || group
            require 'etc'
            owner = Etc.getpwnam( owner ).uid  if owner
            group = Etc.getgrnam( group ).gid  if group
            File.chown owner, group, filename
          end
          mode = config[:UNIXFileMode]
          File.chmod(mode, filename) if mode

          self.new(uri, soc, config, true)
        end

uri_option(uri, config)

[Source]

    # File drb/unix.rb, line 50
        def self.uri_option(uri, config)
          filename, option = parse_uri(uri)
          return "drbunix:#{filename}", option
        end

new(uri, soc, config={}, server_mode = false)

[Source]

    # File drb/unix.rb, line 55
        def initialize(uri, soc, config={}, server_mode = false)
          super(uri, soc, config)
          set_sockopt(@socket)
          @server_mode = server_mode
          @acl = nil
        end

## Public Instance methods

close()

[Source]

    # File drb/unix.rb, line 88
        def close
          return unless @socket
          path = @socket.path
          @socket.close
          File.unlink(path) if @server_mode
          @socket = nil
        end

accept()

[Source]

    # File drb/unix.rb, line 96
        def accept
          s = @socket.accept
          self.class.new(nil, s, @config)
        end

set_sockopt(soc)

[Source]

    # File drb/unix.rb, line 101
        def set_sockopt(soc)
          soc.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) if defined? Fcntl::O_NONBLOCK
          soc.fcntl(Fcntl::F_SETFL, Fcntl::FD_CLOEXEC) if defined? Fcntl::FD_CLOEXEC
        end

[Validate]