ry / ebb fork watch download tarball
public this repo is viewable by everyone
Description: web server
Homepage: http://ebb.rubyforge.org
Clone URL: git://github.com/ry/ebb.git
small clean up
Ryan Dahl (author)
2 months ago
commit  01f42b798c714044c56524421f31b4611c5134a9
tree    813661df1ffb773ce52190590d4dc691f3a64f67
parent  c023fa46c39157b09728f57fa5014d71bfcb935f
...
1
2
3
 
 
 
4
5
6
 
7
8
9
10
11
12
13
14
15
 
16
17
18
19
20
21
 
 
22
23
24
25
26
 
27
28
29
30
31
32
33
 
 
 
34
35
36
...
70
71
72
73
74
75
76
 
 
77
78
79
...
 
 
 
1
2
3
4
5
6
7
8
 
 
 
 
 
 
 
 
9
10
11
 
 
 
 
12
13
14
15
16
17
18
19
20
 
 
 
 
 
 
21
22
23
24
25
26
...
60
61
62
 
 
 
 
63
64
65
66
67
0
@@ -1,36 +1,26 @@
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
 module Ebb
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
-end
0
-
0
-require Ebb::LIBDIR + '/../src/ebb_ext'
0
-
0
-module Ebb
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
+
0
   def self.start_server(app, options={})
0
     port = (options[:port] || 4001).to_i
0
- #socket = options[:socket]
0
- timeout = options[:timeout]
0
-
0
- trap('INT') { @running = false }
0
+ # socket = options[:socket]
0
+ # timeout = options[:timeout]
0
     
0
     FFI::server_listen_on_port(port)
0
     
0
     puts "Ebb listening at http://0.0.0.0:#{port}/"
0
     
0
+ trap('INT') { @running = false }
0
     @running = true
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
- end
0
- client = FFI::waiting_clients.shift
0
+ while @running
0
+ FFI::server_process_connections()
0
+ if client = FFI::waiting_clients.shift
0
         process_client(app, client)
0
       end
0
     end
0
@@ -70,10 +60,8 @@ module Ebb
0
     client.finished
0
   end
0
   
0
- module FFI
0
- def self.waiting_clients
0
- @waiting_clients
0
- end
0
+ def FFI.waiting_clients
0
+ @waiting_clients
0
   end
0
   
0
   class Client

Comments

    No one has commented yet.