module Rex::Service

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.

Attributes

alias[RW]

Public Class Methods

hardcore_alias(*args) click to toggle source

Returns the hardcore, as in porno, alias for this service. This is used by the service manager to manage singleton services.

# File lib/rex/service.rb, line 22
def self.hardcore_alias(*args)
  return "__#{args}"
end

Public Instance Methods

cleanup() click to toggle source

Calls stop on the service once the ref count drops.

# File lib/rex/service.rb, line 40
def cleanup
  stop
end
deref() click to toggle source
Calls superclass method Rex::Ref#deref
# File lib/rex/service.rb, line 26
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