Sha256: 69f65bae3cea14e9dd49fa4b41dce6cc71a42984c0b5011252262ea7182c2d15

Contents?: true

Size: 655 Bytes

Versions: 5

Compression:

Stored size: 655 Bytes

Contents

require 'ldap/server'
require 'rbmk/operation'
module RBMK
class Worker

	def self.hire peer, upstream; new(peer, upstream).serve end

	def initialize peer, upstream
		@upstream = upstream
		@upstream.mktemp
		@peer = peer
		@conn = LDAP::Server::Connection.new @peer.socket,
			server: @upstream,
			logger: $log,
			operation_class: RBMK::Operation,
			operation_args: [self],
			schema: @upstream.schema,
			namingContexts: @upstream.root_dse['namingContexts']
		user_init
	end

	def serve
		@conn.handle_requests
	ensure
		@peer.close
	end

protected

	# Patch this method to implement your additional worker init actions
	def user_init; end

end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rbmk-0.1.1 lib/rbmk/worker.rb
rbmk-0.1.0 lib/rbmk/worker.rb
rbmk-0.1.0.i lib/rbmk/worker.rb
rbmk-0.1.0.g lib/rbmk/worker.rb
rbmk-0.1.0.f lib/rbmk/worker.rb