Sha256: 44d6ba4cd770bec99096b43174fca289a262f961d42c31e2ad5c32a48867e2a0

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

# code:
# * George Moschovitis  <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id: server.rb 167 2004-11-23 14:03:10Z gmosx $

require "drb"

require "nitro/application"
require "nitro/server"
require "nitro/app/session"

module N; module App

# = ServerMixin
#
# Usefull application server related methods.
#
module ServerMixin

	def initialize_app
		if $drb_state
			# Cluster mode: use distributed Ruby objects.
			$lm = N::Cluster::Slm.new($drb_lm_server, "druby://:8000")
			$sessions = DRbObject.new(nil, $drb_sessions_cluster)
		else
			# NoCluster mode: use standard Ruby onjects.
			$lm = G::SafeHash.new
			$sessions = N::App::SessionManager.new
		end

		# initialize app
		initialize_sitemap()
		initialize_shaders()
		initialize_events()		
	end
	
end

# = Server
#
# The Application Server. Handles dynamic requests in a web application.
# Dont keepalive (or use a VERY SMALL keepalive). Typically this server
# is used along with a standars http server that handles other resources.
#
class Server < N::Server
	include N::App::ServerMixin
	
	def initialize(name = "AppServer")
		super
		initialize_app()
		
		$log.info "Server listening at #$srv_url"
	end
end

end; end  # module

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nitro-0.5.0 lib/nitro/server/server.rb
nitro-0.6.0 lib/nitro/server/server.rb
nitro-0.7.0 lib/nitro/server/server.rb