raindrops 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitattributes +4 -0
- data/.olddoc.yml +2 -0
- data/GIT-VERSION-GEN +1 -1
- data/README +13 -9
- data/ext/raindrops/extconf.rb +1 -1
- data/ext/raindrops/linux_inet_diag.c +12 -3
- data/lib/raindrops/aggregate/last_data_recv.rb +1 -5
- data/lib/raindrops/linux.rb +2 -2
- data/lib/raindrops/middleware.rb +2 -4
- data/pkg.mk +1 -1
- data/raindrops.gemspec +0 -1
- data/test/test_linux.rb +7 -0
- metadata +4 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0632eff3853589bfe99f749a3db3d12fa991220a
|
|
4
|
+
data.tar.gz: 19c74eeede4492633f1e3b189b24e4a085fbe40f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a818ad3da0618365d832b5979de131a6fbafe3737877e4a4e95891b993ae6f0c90fd8938cb60494c95cd8ffaf67dd75a017549878f46739442f2739512f3b272
|
|
7
|
+
data.tar.gz: 00b463e110ee126cfbda005af3b6f20c084120428aea74982795b1102dcab9487b461b35834cf3a71885c7d11fea29a3a1596d7f010e93e5210b376c5f6cad96
|
data/.gitattributes
ADDED
data/.olddoc.yml
CHANGED
data/GIT-VERSION-GEN
CHANGED
data/README
CHANGED
|
@@ -37,12 +37,15 @@ and "tcp_diag" kernel modules are loaded as they do not autoload correctly
|
|
|
37
37
|
|
|
38
38
|
== Install
|
|
39
39
|
|
|
40
|
-
We recommend GCC 4+ (or compatible) to support the
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
We recommend GCC 4+ (or compatible) to support the __sync builtins
|
|
41
|
+
(__sync_{add,sub}_and_fetch()):
|
|
42
|
+
|
|
43
|
+
http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
|
|
44
|
+
|
|
45
|
+
For non-GCC 4+ users, we also support compilation with the libatomic_ops
|
|
46
|
+
package starting with Raindrops 0.4.0:
|
|
47
|
+
|
|
48
|
+
https://github.com/ivmai/libatomic_ops
|
|
46
49
|
|
|
47
50
|
If you're using a packaged Ruby distribution, make sure you have a C
|
|
48
51
|
compiler and the matching Ruby development libraries and headers.
|
|
@@ -74,7 +77,7 @@ You can get the latest source via git from the following locations:
|
|
|
74
77
|
You may browse the code from the web and download the latest snapshot
|
|
75
78
|
tarballs here:
|
|
76
79
|
|
|
77
|
-
* http://bogomips.org/raindrops.git
|
|
80
|
+
* http://bogomips.org/raindrops.git
|
|
78
81
|
* http://repo.or.cz/w/raindrops.git (gitweb)
|
|
79
82
|
|
|
80
83
|
Inline patches (from "git format-patch") to the mailing list are
|
|
@@ -86,13 +89,14 @@ git itself. See the Documentation/SubmittingPatches document
|
|
|
86
89
|
distributed with git on on patch submission guidelines to follow. Just
|
|
87
90
|
don't email the git mailing list or maintainer with raindrops patches.
|
|
88
91
|
|
|
89
|
-
raindrops is licensed under the LGPL
|
|
92
|
+
raindrops is licensed under the LGPL-2.1+
|
|
90
93
|
|
|
91
94
|
== Contact
|
|
92
95
|
|
|
93
96
|
All feedback (bug reports, user/development discussion, patches, pull
|
|
94
97
|
requests) go to the mailing list: mailto:raindrops-public@bogomips.org
|
|
95
98
|
|
|
96
|
-
Mailing list archives are available
|
|
99
|
+
Mailing list archives are available over HTTP and NNTP:
|
|
97
100
|
|
|
98
101
|
http://bogomips.org/raindrops-public/
|
|
102
|
+
nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
|
data/ext/raindrops/extconf.rb
CHANGED
|
@@ -618,6 +618,13 @@ static VALUE tcp_stats(struct nogvl_args *args, VALUE addr)
|
|
|
618
618
|
return rb_listen_stats(&args->stats);
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
static int drop_placeholders(st_data_t k, st_data_t v, st_data_t ign)
|
|
622
|
+
{
|
|
623
|
+
if ((VALUE)v == Qtrue)
|
|
624
|
+
return ST_DELETE;
|
|
625
|
+
return ST_CONTINUE;
|
|
626
|
+
}
|
|
627
|
+
|
|
621
628
|
/*
|
|
622
629
|
* call-seq:
|
|
623
630
|
* Raindrops::Linux.tcp_listener_stats([addrs[, sock]]) => hash
|
|
@@ -658,10 +665,9 @@ static VALUE tcp_listener_stats(int argc, VALUE *argv, VALUE self)
|
|
|
658
665
|
case T_ARRAY: {
|
|
659
666
|
long i;
|
|
660
667
|
long len = RARRAY_LEN(addrs);
|
|
661
|
-
VALUE cur;
|
|
662
668
|
|
|
663
669
|
if (len == 1) {
|
|
664
|
-
cur = rb_ary_entry(addrs, 0);
|
|
670
|
+
VALUE cur = rb_ary_entry(addrs, 0);
|
|
665
671
|
|
|
666
672
|
rb_hash_aset(rv, cur, tcp_stats(&args, cur));
|
|
667
673
|
return rv;
|
|
@@ -671,7 +677,7 @@ static VALUE tcp_listener_stats(int argc, VALUE *argv, VALUE self)
|
|
|
671
677
|
VALUE cur = rb_ary_entry(addrs, i);
|
|
672
678
|
|
|
673
679
|
parse_addr(&check, cur);
|
|
674
|
-
rb_hash_aset(rv, cur, Qtrue);
|
|
680
|
+
rb_hash_aset(rv, cur, Qtrue /* placeholder */);
|
|
675
681
|
}
|
|
676
682
|
/* fall through */
|
|
677
683
|
}
|
|
@@ -689,6 +695,9 @@ static VALUE tcp_listener_stats(int argc, VALUE *argv, VALUE self)
|
|
|
689
695
|
st_foreach(args.table, NIL_P(addrs) ? st_to_hash : st_AND_hash, rv);
|
|
690
696
|
st_free_table(args.table);
|
|
691
697
|
|
|
698
|
+
if (RHASH_SIZE(rv) > 1)
|
|
699
|
+
rb_hash_foreach(rv, drop_placeholders, Qfalse);
|
|
700
|
+
|
|
692
701
|
/* let GC deal with corner cases */
|
|
693
702
|
if (argc < 2) rb_io_close(sock);
|
|
694
703
|
return rv;
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
# - Kgio::TCPServer#kgio_accept
|
|
14
14
|
# - Kgio::TCPServer#kgio_tryaccept
|
|
15
15
|
module Raindrops::Aggregate::LastDataRecv
|
|
16
|
-
# :stopdoc:
|
|
17
|
-
TCP_Info = Raindrops::TCP_Info
|
|
18
|
-
# :startdoc:
|
|
19
|
-
|
|
20
16
|
# The integer value of +last_data_recv+ is sent to this object.
|
|
21
17
|
# This is usually a duck type compatible with the \Aggregate class,
|
|
22
18
|
# but can be *anything* that accepts the *<<* method.
|
|
@@ -78,7 +74,7 @@ def accept_nonblock
|
|
|
78
74
|
# +last_data_recv+ to be accurate
|
|
79
75
|
def count!(io)
|
|
80
76
|
if io
|
|
81
|
-
x = TCP_Info.new(io)
|
|
77
|
+
x = Raindrops::TCP_Info.new(io)
|
|
82
78
|
@raindrops_aggregate << x.last_data_recv
|
|
83
79
|
end
|
|
84
80
|
io
|
data/lib/raindrops/linux.rb
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
# Instead of snapshotting, Raindrops::Aggregate::LastDataRecv may be used
|
|
9
9
|
# to aggregate statistics from +all+ accepted sockets as they arrive
|
|
10
10
|
# based on the +last_data_recv+ field in Raindrops::TCP_Info
|
|
11
|
-
require 'pathname'
|
|
12
11
|
|
|
13
12
|
module Raindrops::Linux
|
|
14
13
|
|
|
@@ -46,7 +45,8 @@ def unix_listener_stats(paths = nil)
|
|
|
46
45
|
path.force_encoding(Encoding::BINARY) if defined?(Encoding)
|
|
47
46
|
if File.symlink?(path)
|
|
48
47
|
link = path
|
|
49
|
-
path =
|
|
48
|
+
path = File.readlink(link)
|
|
49
|
+
path.force_encoding(Encoding::BINARY) if defined?(Encoding)
|
|
50
50
|
rv[link] = rv[path] # vivify ListenerStats
|
|
51
51
|
else
|
|
52
52
|
rv[path] # vivify ListenerStats
|
data/lib/raindrops/middleware.rb
CHANGED
|
@@ -77,11 +77,9 @@ class Raindrops::Middleware
|
|
|
77
77
|
# and both counters are updated atomically.
|
|
78
78
|
#
|
|
79
79
|
# This is supported on all operating systems supported by Raindrops
|
|
80
|
-
|
|
81
|
-
end
|
|
80
|
+
Stats = Raindrops::Struct.new(:calling, :writing)
|
|
82
81
|
|
|
83
82
|
# :stopdoc:
|
|
84
|
-
PATH_INFO = "PATH_INFO"
|
|
85
83
|
require "raindrops/middleware/proxy"
|
|
86
84
|
# :startdoc:
|
|
87
85
|
|
|
@@ -111,7 +109,7 @@ def initialize(app, opts = {})
|
|
|
111
109
|
|
|
112
110
|
# standard Rack endpoint
|
|
113
111
|
def call(env) # :nodoc:
|
|
114
|
-
env[PATH_INFO] == @path and return stats_response
|
|
112
|
+
env['PATH_INFO'] == @path and return stats_response
|
|
115
113
|
begin
|
|
116
114
|
@stats.incr_calling
|
|
117
115
|
|
data/pkg.mk
CHANGED
data/raindrops.gemspec
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
s.add_development_dependency('io-extra', [ '~> 1.2', '>= 1.2.3'])
|
|
25
25
|
s.add_development_dependency('posix_mq', '~> 2.0')
|
|
26
26
|
s.add_development_dependency('rack', '~> 1.2')
|
|
27
|
-
s.add_development_dependency('unicorn', '>= 0.98')
|
|
28
27
|
s.add_development_dependency('olddoc', '~> 1.0')
|
|
29
28
|
|
|
30
29
|
s.licenses = %w(LGPL-2.1+)
|
data/test/test_linux.rb
CHANGED
|
@@ -214,6 +214,13 @@ def test_tcp_multi
|
|
|
214
214
|
assert_equal 0, stats[addr1].active
|
|
215
215
|
assert_equal 1, stats[addr2].queued
|
|
216
216
|
assert_equal 1, stats[addr2].active
|
|
217
|
+
|
|
218
|
+
# make sure we don't leave "true" placeholders in results if a
|
|
219
|
+
# listener becomes invalid (even momentarily).
|
|
220
|
+
s2.close
|
|
221
|
+
stats = tcp_listener_stats(addrs)
|
|
222
|
+
assert stats.values.all? { |x| x.instance_of?(Raindrops::ListenStats) },
|
|
223
|
+
"placeholders left: #{stats.inspect}"
|
|
217
224
|
end
|
|
218
225
|
|
|
219
226
|
# tries to overflow buffers
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: raindrops
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- raindrops hackers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aggregate
|
|
@@ -86,20 +86,6 @@ dependencies:
|
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '1.2'
|
|
89
|
-
- !ruby/object:Gem::Dependency
|
|
90
|
-
name: unicorn
|
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - ">="
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: '0.98'
|
|
96
|
-
type: :development
|
|
97
|
-
prerelease: false
|
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - ">="
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '0.98'
|
|
103
89
|
- !ruby/object:Gem::Dependency
|
|
104
90
|
name: olddoc
|
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -143,6 +129,7 @@ extra_rdoc_files:
|
|
|
143
129
|
- ext/raindrops/linux_tcp_info.c
|
|
144
130
|
files:
|
|
145
131
|
- ".document"
|
|
132
|
+
- ".gitattributes"
|
|
146
133
|
- ".gitignore"
|
|
147
134
|
- ".manifest"
|
|
148
135
|
- ".olddoc.yml"
|
|
@@ -219,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
219
206
|
version: '0'
|
|
220
207
|
requirements: []
|
|
221
208
|
rubyforge_project:
|
|
222
|
-
rubygems_version: 2.5.
|
|
209
|
+
rubygems_version: 2.5.2
|
|
223
210
|
signing_key:
|
|
224
211
|
specification_version: 4
|
|
225
212
|
summary: real-time stats for preforking Rack servers
|