Sha256: e4ca398f4ea819e03f0435887542d5f51c8dd97c29a49d63b4767dd1984da14f

Contents?: true

Size: 898 Bytes

Versions: 15

Compression:

Stored size: 898 Bytes

Contents

# -*- coding: binary -*-
require 'rex'
require 'rex/proto'

module Rex

###
#
# The service module is used to extend classes that are passed into the
# service manager start routine.  It provides extra methods, such as reference
# counting, that are used to track the service instances more uniformly.
#
###
module Service
  include Ref

  require 'rex/services/local_relay'

  #
  # Returns the hardcore, as in porno, alias for this service.  This is used
  # by the service manager to manage singleton services.
  #
  def self.hardcore_alias(*args)
    return "__#{args}"
  end

  def deref
    rv = super

    # If there's only one reference, then it's the service managers.
    if @_references == 1
      Rex::ServiceManager.stop_service(self)
    end

    rv
  end

  #
  # Calls stop on the service once the ref count drops.
  #
  def cleanup
    stop
  end

  attr_accessor :alias

end

end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
rex-2.0.13 lib/rex/service.rb
rex-2.0.12 lib/rex/service.rb
rex-2.0.11 lib/rex/service.rb
rex-2.0.10 lib/rex/service.rb
rex-2.0.9 lib/rex/service.rb
rex-2.0.8 lib/rex/service.rb
rex-2.0.7 lib/rex/service.rb
rex-2.0.5 lib/rex/service.rb
rex-2.0.4 lib/rex/service.rb
dstruct-0.0.1 lib/rex/service.rb
rex-2.0.3 lib/rex/service.rb
librex-0.0.999 lib/rex/service.rb
rex-2.0.2 lib/rex/service.rb
librex-0.0.71 lib/rex/service.rb
librex-0.0.70 lib/rex/service.rb