raindrops 0.4.1 - more portability!
[raindrops.git] / lib / raindrops.rb
blob354ae397c0d03ba1bd15a6952ed05152759253fc
1 # -*- encoding: binary -*-
2 class Raindrops
4   # Raindrops is currently at version 0.4.1
5   VERSION = '0.4.1'
7   # Used to represent the number of +active+ and +queued+ sockets for
8   # a single listen socket across all threads and processes on a
9   # machine.
10   #
11   # For TCP listeners, only sockets in the TCP_ESTABLISHED state are
12   # accounted for.  For Unix domain listeners, only CONNECTING and
13   # CONNECTED Unix domain sockets are accounted for.
14   #
15   # +active+ connections is the number of accept()-ed but not-yet-closed
16   # sockets in all threads/processes sharing the given listener.
17   #
18   # +queued+ connections is the number of un-accept()-ed sockets in the
19   # queue of a given listen socket.
20   #
21   # These stats are currently only available under Linux
22   class ListenStats < Struct.new(:active, :queued)
24     # the sum of +active+ and +queued+ sockets
25     def total
26       active + queued
27     end
28   end
30   # TODO: pure Ruby version for single processes
31   require 'raindrops_ext'
33   autoload :Struct, 'raindrops/struct'
34   autoload :Middleware, 'raindrops/middleware'
35 end