lib/n/sync/server.rb in nitro-0.1.2 vs lib/n/sync/server.rb in nitro-0.2.0

- old
+ new

@@ -1,25 +1,11 @@ -# = Syncrhronous Server +# code: +# * George Moschovitis <gm@navel.gr> +# * Anastasios Koutoumanos <ak@navel.gr> # -# === Design: -# -# Should support clustered operation: A cluster of servers is spawned. -# The client connects to one of the servers at random. The client sticks -# to the server. Each server considers the others as clients and -# rebroadcasts all the events. -# -# We keep one service per server for simplicity, if we need multiple -# services we can implement a multiplexer service (handler). -# -# === TODO: -# -# - Investigate if this server can be done with select. -# -# code: gmosx, drak -# # (c) 2004 Navel, all rights reserved. -# $Id: server.rb 71 2004-10-18 10:50:22Z gmosx $ +# $Id: server.rb 101 2004-10-22 12:35:39Z gmosx $ require "thread" require "socket" require "rexml/document" @@ -39,10 +25,24 @@ # # The Macromedia XML Socket protocol is used, \000 is used as a eof # marker. NO: the XML protocol is not really appropriate, better use # a space optimized delimited ASCII protocol. # +# === Design: +# +# Should support clustered operation: A cluster of servers is spawned. +# The client connects to one of the servers at random. The client sticks +# to the server. Each server considers the others as clients and +# rebroadcasts all the events. +# +# We keep one service per server for simplicity, if we need multiple +# services we can implement a multiplexer service (handler). +# +# === TODO: +# +# - Investigate if this server can be done with select. +# class Server < N::Application MONITOR_INTERVAL = 2 * 60 # a single tcp server accepts all tcp requests attr :tcp_server @@ -76,21 +76,27 @@ @handler_class = handler_class super() end + # Start the server. + # def start() # a single tcp server accepts all tcp requests @tcp_server = TCPServer.new(address, port) start_monitor() run() end + # Stop the server. + # def stop() @status = STATUS_STOPED end + # Run the main loop of the server. + # def run() @status = STATUS_RUNNING $log.info "Server is running." begin