Files
metasploit-gs/lib/rex/service.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
859 B
Ruby
Raw Normal View History

# -*- coding: binary -*-
2005-08-22 04:34:40 +00:00
require 'rex'
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
2005-09-29 20:18:24 +00:00
#
# 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)
2022-02-12 00:22:08 +00:00
return true
end
rv
end
#
# Calls stop on the service once the ref count drops.
#
def cleanup
stop
end
2005-09-29 20:18:24 +00:00
attr_accessor :alias
2005-08-22 04:34:40 +00:00
end
2012-04-15 23:35:38 -05:00
end