1 # -*- encoding: binary -*-
4 # Used to aggregate last_data_recv times
5 module Raindrops::Aggregate::LastDataRecv
6 TCP_Info = Raindrops::TCP_Info
7 attr_accessor :raindrops_aggregate
8 @@default_aggregate = nil
10 def self.default_aggregate
11 @@default_aggregate ||= Raindrops::Aggregate::PMQ.new
14 def self.default_aggregate=(agg)
15 @@default_aggregate = agg
19 Unicorn::HttpServer::LISTENERS.each do |sock|
20 sock.extend(self) if TCPServer === sock
24 def self.extended(obj)
25 obj.raindrops_aggregate = default_aggregate
26 obj.setsockopt Socket::SOL_TCP, tcp_defer_accept = 9, seconds = 60
29 def kgio_tryaccept(*args)
33 def kgio_accept(*args)
48 @raindrops_aggregate << x.last_data_recv