0
-# A ruby binding to the ebb web server
0
-# Copyright (c) 2007 Ry Dahl <ry.d4hl@gmail.com>
0
-# This software is released under the "MIT License". See README file for details.
0
+# Ruby Binding to the Ebb Web Server
0
+# Copyright (c) 2008 Ry Dahl. This software is released under the MIT License.
0
+# See README file for details.
0
LIBDIR = File.dirname(__FILE__)
0
VERSION = File.read(LIBDIR + "/../VERSION").gsub(/\s/,'')
0
+ require Ebb::LIBDIR + '/../src/ebb_ext'
0
autoload :Runner, LIBDIR + '/ebb/runner'
0
-require Ebb::LIBDIR + '/../src/ebb_ext'
0
- # "Gasp! No Server class! But this is Object Oriented Programming - we
0
- # classes for servers!", you say. Not when there always will be
0
- # exactly one server per virtual machine.
0
def self.start_server(app, options={})
0
port = (options[:port] || 4001).to_i
0
- #socket = options[:socket]
0
- timeout = options[:timeout]
0
- trap('INT') { @running = false }
0
+ # socket = options[:socket]
0
+ # timeout = options[:timeout]
0
FFI::server_listen_on_port(port)
0
puts "Ebb listening at http://0.0.0.0:#{port}/"
0
+ trap('INT') { @running = false }
0
- while FFI::server_process_connections() and @running
0
- unless FFI::waiting_clients.empty?
0
- if $DEBUG and $ebb_waiting_clients.length > 1
0
- puts "#{FFI::waiting_clients.length} waiting clients"
0
- client = FFI::waiting_clients.shift
0
+ FFI::server_process_connections()
0
+ if client = FFI::waiting_clients.shift
0
process_client(app, client)
0
@@ -70,10 +60,8 @@ module Ebb
0
- def self.waiting_clients
0
+ def FFI.waiting_clients
Comments
No one has commented yet.