Files
metasploit-gs/lib/rex/service.rb
T
kris 248f1e9fc3 Remove "#{xxx.to_s}" redundancies ('s/\(#{[^}]*\)\.to_s}/\1}/g')
git-svn-id: file:///home/svn/framework3/trunk@6022 4d416f70-5f16-0410-b530-b9f4589650da
2008-12-19 07:11:08 +00:00

48 lines
839 B
Ruby

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