Sha256: 42b6bd591a61f78f118c360a20e2bcf4e5270a22ed317ccd435d97ed43a9225e

Contents?: true

Size: 865 Bytes

Versions: 2

Compression:

Stored size: 865 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

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/service.rb
librex-0.0.66 lib/rex/service.rb