raindrops 0.13.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.document +1 -2
  3. data/.gitattributes +4 -0
  4. data/.gitignore +1 -1
  5. data/.manifest +7 -5
  6. data/.olddoc.yml +16 -0
  7. data/GIT-VERSION-FILE +1 -1
  8. data/GIT-VERSION-GEN +1 -1
  9. data/GNUmakefile +1 -2
  10. data/LATEST +6 -11
  11. data/LICENSE +3 -3
  12. data/NEWS +158 -0
  13. data/README +33 -40
  14. data/TODO +2 -0
  15. data/archive/.gitignore +3 -0
  16. data/archive/slrnpull.conf +4 -0
  17. data/examples/linux-listener-stats.rb +1 -2
  18. data/examples/watcher_demo.ru +1 -1
  19. data/examples/yahns.conf.rb +30 -0
  20. data/examples/zbatery.conf.rb +4 -1
  21. data/ext/raindrops/extconf.rb +107 -2
  22. data/ext/raindrops/linux_inet_diag.c +94 -101
  23. data/ext/raindrops/raindrops.c +75 -21
  24. data/ext/raindrops/tcp_info.c +245 -0
  25. data/lib/raindrops/aggregate/last_data_recv.rb +1 -5
  26. data/lib/raindrops/aggregate/pmq.rb +23 -17
  27. data/lib/raindrops/aggregate.rb +1 -1
  28. data/lib/raindrops/linux.rb +5 -6
  29. data/lib/raindrops/middleware/proxy.rb +2 -2
  30. data/lib/raindrops/middleware.rb +4 -6
  31. data/lib/raindrops/watcher.rb +13 -13
  32. data/lib/raindrops.rb +25 -1
  33. data/pkg.mk +26 -50
  34. data/raindrops.gemspec +14 -21
  35. data/test/ipv6_enabled.rb +4 -4
  36. data/test/test_aggregate_pmq.rb +1 -1
  37. data/test/test_inet_diag_socket.rb +1 -1
  38. data/test/test_last_data_recv_unicorn.rb +1 -1
  39. data/test/test_linux.rb +10 -2
  40. data/test/test_linux_all_tcp_listen_stats_leak.rb +2 -2
  41. data/test/test_linux_ipv6.rb +8 -0
  42. data/test/test_raindrops.rb +43 -1
  43. data/test/{test_linux_tcp_info.rb → test_tcp_info.rb} +34 -14
  44. data/test/test_watcher.rb +15 -10
  45. metadata +59 -171
  46. data/.wrongdoc.yml +0 -6
  47. data/ChangeLog +0 -1920
  48. data/Rakefile +0 -28
  49. data/ext/raindrops/linux_tcp_info.c +0 -173
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f78e29ec57e3f3710146a423cf60915d23a5f4366d70dcabbbef74fb69f71f3
4
+ data.tar.gz: 8a369d49c33a67af3b6acccaf64b04ed192cba9d163c8d48944cfac887511885
5
+ SHA512:
6
+ metadata.gz: b9e5de8e7a7a84038bbe19a954d3d559ebec3ed4c7f68db2e2ada6373b045f4fbcd784c5d5b91005cad1d87f1db93f9dc31c9f7fc59ae56a7f73b98d9a96bf2e
7
+ data.tar.gz: 9913e9205b2527b9f5bd1bae58b0c2c8962505e87280c06257f603fb722978d6656c99cfa0a297ccd0734a7d6110b0a6ecd5155fec9870ec40a31044a00def4d
data/.document CHANGED
@@ -1,8 +1,7 @@
1
1
  README
2
2
  LICENSE
3
3
  NEWS
4
- ChangeLog
5
4
  lib
6
5
  ext/raindrops/raindrops.c
7
6
  ext/raindrops/linux_inet_diag.c
8
- ext/raindrops/linux_tcp_info.c
7
+ ext/raindrops/tcp_info.c
data/.gitattributes ADDED
@@ -0,0 +1,4 @@
1
+ *.gemspec diff=ruby
2
+ *.rb diff=ruby
3
+ *.ru diff=ruby
4
+ Rakefile diff=ruby
data/.gitignore CHANGED
@@ -5,7 +5,7 @@
5
5
  Makefile
6
6
  /GIT-VERSION-FILE
7
7
  /local.mk
8
- /NEWS
8
+ /NEWS*
9
9
  /ChangeLog
10
10
  /.manifest
11
11
  /man
data/.manifest CHANGED
@@ -1,9 +1,9 @@
1
1
  .document
2
+ .gitattributes
2
3
  .gitignore
3
4
  .manifest
4
- .wrongdoc.yml
5
+ .olddoc.yml
5
6
  COPYING
6
- ChangeLog
7
7
  GIT-VERSION-FILE
8
8
  GIT-VERSION-GEN
9
9
  GNUmakefile
@@ -11,19 +11,21 @@ LATEST
11
11
  LICENSE
12
12
  NEWS
13
13
  README
14
- Rakefile
15
14
  TODO
15
+ archive/.gitignore
16
+ archive/slrnpull.conf
16
17
  examples/linux-listener-stats.rb
17
18
  examples/middleware.ru
18
19
  examples/watcher.ru
19
20
  examples/watcher_demo.ru
21
+ examples/yahns.conf.rb
20
22
  examples/zbatery.conf.rb
21
23
  ext/raindrops/extconf.rb
22
24
  ext/raindrops/linux_inet_diag.c
23
- ext/raindrops/linux_tcp_info.c
24
25
  ext/raindrops/my_fileno.h
25
26
  ext/raindrops/raindrops.c
26
27
  ext/raindrops/raindrops_atomic.h
28
+ ext/raindrops/tcp_info.c
27
29
  lib/raindrops.rb
28
30
  lib/raindrops/aggregate.rb
29
31
  lib/raindrops/aggregate/last_data_recv.rb
@@ -47,11 +49,11 @@ test/test_linux_all_tcp_listen_stats.rb
47
49
  test/test_linux_all_tcp_listen_stats_leak.rb
48
50
  test/test_linux_ipv6.rb
49
51
  test/test_linux_middleware.rb
50
- test/test_linux_tcp_info.rb
51
52
  test/test_middleware.rb
52
53
  test/test_middleware_unicorn.rb
53
54
  test/test_middleware_unicorn_ipv6.rb
54
55
  test/test_raindrops.rb
55
56
  test/test_raindrops_gc.rb
56
57
  test/test_struct.rb
58
+ test/test_tcp_info.rb
57
59
  test/test_watcher.rb
data/.olddoc.yml ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ cgit_url: https://yhbt.net/raindrops.git/
3
+ rdoc_url: https://yhbt.net/raindrops/
4
+ public_email: raindrops-public@yhbt.net
5
+ ml_url:
6
+ - https://yhbt.net/raindrops-public/
7
+ - http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops-public
8
+ imap_url:
9
+ - imaps://yhbt.net/inbox.comp.lang.ruby.raindrops.0
10
+ - imap://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops.0
11
+ nntp_url:
12
+ - nntps://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
13
+ - nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops
14
+ source_code:
15
+ - git clone https://yhbt.net/raindrops.git
16
+ - torsocks git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops.git
data/GIT-VERSION-FILE CHANGED
@@ -1 +1 @@
1
- GIT_VERSION = 0.13.0
1
+ GIT_VERSION = 0.20.0
data/GIT-VERSION-GEN CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v0.13.0
4
+ DEF_VER=v0.20.0
5
5
 
6
6
  LF='
7
7
  '
data/GNUmakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  all::
2
- RSYNC_DEST := bogomips.org:/srv/raindrops
3
- rfproject := rainbows
2
+ RSYNC_DEST := yhbt.net:/srv/yhbt/raindrops
4
3
  rfpackage := raindrops
5
4
  include pkg.mk
data/LATEST CHANGED
@@ -1,15 +1,10 @@
1
- === raindrops 0.13.0 several minor fixes and improvements / 2014-02-18 20:59 UTC
1
+ === raindrops 0.20.0 / 2021-12-06 23:41 UTC
2
2
 
3
- Most notably, this release is necessary for Ruby 2.2 (dev).
4
- Thanks to Koichi Sasada for the bug report!
3
+ Raindrops may now use file-backed mmap() rather than anonymous
4
+ memory. Thanks to KJ Tsanaktsidis for the patch:
5
5
 
6
- Eric Wong (5):
7
- Rakefile: remove raa_update task
8
- last_data_recv: do not assume Unicorn includes all constants
9
- raindrops.gemspec: add wrongdoc dev dependency
10
- linux_inet_diag: fix Ruby 2.2 (dev) build
11
- license: use LGPLv2.1 or later (was LGPL (2.1|3.0)-only)
6
+ https://yhbt.net/raindrops-public/20211125065618.3432-1-ktsanaktsidis@zendesk.com/T/
12
7
 
13
- Hleb Valoshka (1):
14
- Remove Scope IDs from IPv6 addresses.
8
+ The documentation is also updated to note our mail archives are now
9
+ available via IMAP(S).
15
10
 
data/LICENSE CHANGED
@@ -3,8 +3,8 @@ revision control for names and email addresses of all of them.
3
3
 
4
4
  You can redistribute it and/or modify it under the terms of the GNU
5
5
  Lesser General Public License (LGPL) as published by the Free Software
6
- Foundation, version {2.1}[http://www.gnu.org/licenses/lgpl-2.1.txt] or
7
- later. Currently version {3}[http://www.gnu.org/licenses/lgpl-3.0.txt],
6
+ Foundation, version {2.1}[https://www.gnu.org/licenses/lgpl-2.1.txt] or
7
+ later. Currently version {3}[https://www.gnu.org/licenses/lgpl-3.0.txt],
8
8
  is preferred (see link:COPYING).
9
9
 
10
10
  raindrops is distributed in the hope that it will be useful, but WITHOUT
@@ -13,4 +13,4 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13
13
  License for more details.
14
14
 
15
15
  You should have received a copy of the GNU Lesser General Public License
16
- along with the raindrops; if not, see <http://www.gnu.org/licenses/>
16
+ along with the raindrops; if not, see <https://www.gnu.org/licenses/>
data/NEWS CHANGED
@@ -1,3 +1,161 @@
1
+ === raindrops 0.20.0 / 2021-12-06 23:41 UTC
2
+
3
+ Raindrops may now use file-backed mmap() rather than anonymous
4
+ memory. Thanks to KJ Tsanaktsidis for the patch:
5
+
6
+ https://yhbt.net/raindrops-public/20211125065618.3432-1-ktsanaktsidis@zendesk.com/T/
7
+
8
+ The documentation is also updated to note our mail archives are now
9
+ available via IMAP(S).
10
+
11
+ === raindrops 0.19.2 / 2021-05-25 23:13 UTC
12
+
13
+ This release fixes compatibility with GC.compact on Ruby 3.x
14
+ when using ListenStats on Linux. The listener stats
15
+ functionality is rarely used and does not affect most users
16
+ who just have raindrops installed for shared atomic counters.
17
+
18
+ === raindrops 0.19.1 / 2020-01-08 09:31 UTC
19
+
20
+ This release fixes some warnings on newer Rubies.
21
+
22
+ We're no longer on bogomips.org since it's due
23
+ for expiry and I can't pay extortionists for a .org, so
24
+ s/bogomips.org/yhbt.net/ for now, and be prepared to move again
25
+ when extortionists move onto extorting the .net TLD.
26
+
27
+ doc: switch homepage to dark216
28
+ ext/raindrops/extconf: fix cflags reset on ancient CC
29
+ fixes for newer rubies
30
+ replace bogomips.org with yhbt.net
31
+
32
+ === raindrops 0.19.0 - Rack 2.x middleware compatibility / 2017-08-09 23:52 UTC
33
+
34
+ This release fixes Rack 2.x compatibility for the few users of
35
+ Raindrops::Middleware
36
+ <https://bogomips.org/raindrops/Raindrops/Middleware.html>.
37
+ Thanks to Dmytro Shteflyuk for this release.
38
+
39
+ No need to upgrade unless you use Raindrops::Middleware with
40
+ Rack 2.x.
41
+
42
+ There's also a few minor, inconsequential cleanups.
43
+
44
+ Dmytro Shteflyuk (1):
45
+ Properly override respond_to? in Raindrops::Middleware::Proxy
46
+
47
+ Eric Wong (2):
48
+ Ruby thread compatibility updates
49
+ tcp_info: remove unnecessary extconf.h include
50
+
51
+ === raindrops 0.18.0 / 2017-03-23 02:44 UTC
52
+
53
+ The most notable feature of this release is the addition of
54
+ FreeBSD and OpenBSD TCP_INFO support. This includes the
55
+ Raindrops::TCP for portably mapping TCP state names to
56
+ platform-dependent numeric values:
57
+
58
+ https://bogomips.org/raindrops/Raindrops.html#TCP
59
+
60
+ Thanks to Jeremy Evans and Simon Eskildsen on the
61
+ unicorn-public@bogomips.org mailing list for inspiring
62
+ these changes to raindrops.
63
+
64
+ There's also a few internal cleanups, and documentation
65
+ improvements, including some fixes to the largely-forgotten
66
+ Raindrops::Aggreage::PMQ class:
67
+
68
+ https://bogomips.org/raindrops/Raindrops/Aggregate/PMQ.html
69
+
70
+ 20 changes since 0.17.0:
71
+
72
+ test_inet_diag_socket: fix Fixnum deprecation warning
73
+ TODO: add item for IPv6 breakage
74
+ ext: fix documentation for C ext-defined classes
75
+ TCP_Info: custom documentation for #get!
76
+ TypedData C-API conversion
77
+ test_watcher: disable test correctly when aggregate is missing
78
+ tcp_info: support this struct under FreeBSD
79
+ define Raindrops::TCP hash for TCP states
80
+ linux_inet_diag: reduce stack usage and simplify
81
+ avoid reading errno repeatedly
82
+ aggregate/pmq: avoid false sharing of lock buffers
83
+ aggregate/pmq: remove io-extra requirement
84
+ aggregate/pmq: avoid File#stat allocation
85
+ Merge remote-tracking branch 'origin/freebsd'
86
+ Merge remote-tracking branch 'origin/aggregate-pmq'
87
+ doc: remove private email support address
88
+ doc: update location of TCP_INFO-related stuff
89
+ build: avoid olddoc for building the RubyGem
90
+ doc: document Raindrops::TCP hash
91
+ aggregate/pmq: update version numbers for Ruby and Linux
92
+
93
+ === raindrops 0.17.0 - rack 2.x updates / 2016-07-31 15:19 UTC
94
+
95
+ This release features minor updates to support rack 2.x
96
+ while maintaining support for rack 1.2 and later.
97
+ As a result, Ruby 1.8.6 compatibility is gone, but
98
+ Ruby 1.8.7 probably still works, for now.
99
+
100
+ There's also a minor warning fix, doc updates, and
101
+ the homepage now supports HTTPS (HTTP remains supported)
102
+
103
+ 5 changes since raindrops 0.16.0:
104
+ drop Rack::Utils.bytesize dependency
105
+ gemspec: bump Rack dependency
106
+ linux_inet_diag: GCC attribute format check
107
+ use HTTPS and move homepage to https://bogomips.org/raindrops/
108
+ examples: add yahns config, zbatery is abandoned
109
+
110
+ === raindrops 0.16.0 - minor fixes and workarounds / 2016-02-29 12:36 UTC
111
+
112
+ There's mainly a fix/workaround for Ruby 2.3 now returning
113
+ locale-aware strings for File.readlink and our test suite
114
+ using strange paths allowed by *nix.
115
+
116
+ https://bugs.ruby-lang.org/issues/12034
117
+
118
+ tcp_listener_stats won't return "true" object placeholders
119
+ if stats are configured for a non-existent listener.
120
+
121
+ There are also minor optimizations for Ruby 2.2+ (at the expense
122
+ of 2.1 and earlier).
123
+
124
+ And the usual round of minor tweaks and doc updates.
125
+
126
+ 10 changes since v0.15.0:
127
+ gemspec: avoid circular dependency on unicorn
128
+ remove optimizations which made sense for older rubies
129
+ linux: workaround Ruby 2.3 change
130
+ linux: remove Pathname stdlib dependency
131
+ add .gitattributes for Ruby method detection
132
+ middleware: minor bytecode size reduction
133
+ doc: update URLs and references
134
+ README: remove indentation from URLs in RDoc
135
+ linux: tcp_listener_stats drops "true" placeholders
136
+ build: use '--local' domain for dev gem install
137
+
138
+ === raindrops 0.15.0 - non-glibc compat fix on Linux / 2015-07-22 00:30 UTC
139
+
140
+ Thanks to Doug Forster for sending us the report.
141
+ No other fixes
142
+
143
+ * check for the existence of linux/tcp.h
144
+
145
+ === raindrops 0.14.0 - misc doc updates / 2015-06-25 21:50 UTC
146
+
147
+ Eric Wong (7):
148
+ linux_inet_diag: annotate memory freeing on diag errors
149
+ README: trim intro and update license
150
+ modernize packaging and documentation
151
+ move mailing list to raindrops-public@bogomips.org
152
+ linux_inet_diag: clarify *fprintf usage without GVL
153
+ TODO: add item for unix_diag and udp_diag
154
+ linux_inet_diag: fix Wshorten-64-to-32 warnings
155
+
156
+ Hleb Valoshka (1):
157
+ Add setup and teardown for ipv6 tests
158
+
1
159
  === raindrops 0.13.0 several minor fixes and improvements / 2014-02-18 20:59 UTC
2
160
 
3
161
  Most notably, this release is necessary for Ruby 2.2 (dev).
data/README CHANGED
@@ -1,11 +1,10 @@
1
1
  = raindrops - real-time stats for preforking Rack servers
2
2
 
3
- Raindrops is a real-time stats toolkit to show statistics for Rack HTTP
4
- servers. It is designed for preforking servers such as Rainbows! and
5
- Unicorn, but should support any Rack HTTP server under Ruby 2.0, 1.9,
6
- 1.8 and Rubinius on platforms supporting POSIX shared memory. It may
7
- also be used as a generic scoreboard for sharing atomic counters across
8
- multiple processes.
3
+ raindrops is a real-time stats toolkit to show statistics for Rack HTTP
4
+ servers. It is designed for preforking servers such as unicorn, but
5
+ should support any Rack HTTP server on platforms supporting POSIX shared
6
+ memory. It may also be used as a generic scoreboard for sharing atomic
7
+ counters across multiple processes.
9
8
 
10
9
  == Features
11
10
 
@@ -38,12 +37,15 @@ and "tcp_diag" kernel modules are loaded as they do not autoload correctly
38
37
 
39
38
  == Install
40
39
 
41
- We recommend GCC 4+ (or compatible) to support the
42
- {atomic builtins}[http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html]
43
- (__sync_{add,sub}_and_fetch()). For non-GCC 4+ users, we also support
44
- compilation with the
45
- {libatomic_ops}[http://www.hpl.hp.com/research/linux/atomic_ops/]
46
- package starting with Raindrops 0.4.0.
40
+ We recommend GCC 4+ (or compatible) to support the __sync builtins
41
+ (__sync_{add,sub}_and_fetch()):
42
+
43
+ https://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
47
49
 
48
50
  If you're using a packaged Ruby distribution, make sure you have a C
49
51
  compiler and the matching Ruby development libraries and headers.
@@ -52,33 +54,24 @@ If you use RubyGems:
52
54
 
53
55
  gem install raindrops
54
56
 
55
- Otherwise grab the latest tarball from:
56
-
57
- http://raindrops.bogomips.org/files/
58
-
59
- Unpack it, and run "ruby setup.rb"
60
-
61
57
  == Usage
62
58
 
63
59
  See Raindrops::Middleware and Raindrops::LastDataRecv documentation for
64
60
  use Rack servers. The entire library is fully-documented and we are
65
- responsive on the mailing list (mailto:raindrops@librelist.org) if you
66
- have any questions or comments.
61
+ responsive on the publicly archived mailbox
62
+ (mailto:raindrops-public@yhbt.net) if you have any questions or comments.
67
63
 
68
64
  == Development
69
65
 
70
66
  You can get the latest source via git from the following locations:
71
67
 
72
- git://bogomips.org/raindrops.git
73
- git://repo.or.cz/raindrops.git (mirror)
68
+ https://yhbt.net/raindrops.git
69
+ http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops.git
70
+ http://repo.or.cz/w/raindrops.git (gitweb mirror)
74
71
 
75
- You may browse the code from the web and download the latest snapshot
76
- tarballs here:
72
+ Snapshots and tarballs are available.
77
73
 
78
- * http://bogomips.org/raindrops.git (cgit)
79
- * http://repo.or.cz/w/raindrops.git (gitweb)
80
-
81
- Inline patches (from "git format-patch") to the mailing list are
74
+ Inline patches (from "git format-patch") to the mailbox are
82
75
  preferred because they allow code review and comments in the reply to
83
76
  the patch.
84
77
 
@@ -87,22 +80,22 @@ git itself. See the Documentation/SubmittingPatches document
87
80
  distributed with git on on patch submission guidelines to follow. Just
88
81
  don't email the git mailing list or maintainer with raindrops patches.
89
82
 
90
- raindrops is currently dual-licensed under the LGPLv2.1 and LGPLv3. To
91
- allow for a transition to future versions of the LGPL, contributors are
92
- required to sign-off changes allowing allowing the project leader to
93
- relicense raindrops under newer versions of the LGPL (which should be
94
- similar in spirit to the existing LGPL).
83
+ raindrops is licensed under the LGPL-2.1+
95
84
 
96
85
  == Contact
97
86
 
98
87
  All feedback (bug reports, user/development discussion, patches, pull
99
- requests) go to the mailing list: mailto:raindrops@librelist.org
100
-
101
- The mailing list is mirrored to Gmane, all information about the
102
- group is here:
88
+ requests) go to the publicly archived mailbox:
89
+ mailto:raindrops-public@yhbt.net
103
90
 
104
- http://gmane.org/info.php?group=gmane.comp.lang.ruby.raindrops.general
91
+ Mail archives are available over HTTP(S), IMAP(S) and NNTP(S):
105
92
 
106
- Mailing list archives in mbox format may be downloaded here:
93
+ * https://yhbt.net/raindrops-public/
94
+ * http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops-public/
95
+ * imaps://yhbt.net/inbox.comp.lang.ruby.raindrops.0
96
+ * imap://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops.0
97
+ * nntps://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
98
+ * nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops
107
99
 
108
- http://raindrops.bogomips.org/archives/
100
+ Since archives are public, scrub sensitive information and
101
+ use anonymity tools such as Tor or Mixmaster if you deem necessary.
data/TODO CHANGED
@@ -1 +1,3 @@
1
+ * fix IPv6 inet_diag reporting for Raindrops::Middleware
1
2
  * pure Ruby version for non-forking servers (patches welcome!)
3
+ * unix_diag and udp_diag support
@@ -0,0 +1,3 @@
1
+ /data
2
+ /news
3
+ /requests
@@ -0,0 +1,4 @@
1
+ # group_name max expire headers_only
2
+ gmane.comp.lang.ruby.raindrops.general 1000000000 1000000000 0
3
+
4
+ # usage: slrnpull -d $PWD -h news.gmane.org --no-post
@@ -15,7 +15,6 @@ end
15
15
  usage = "Usage: #$0 [-d DELAY] [-t QUEUED_THRESHOLD] ADDR..."
16
16
  ARGV.size > 0 or abort usage
17
17
  delay = false
18
- all = false
19
18
  queued_thresh = -1
20
19
  # "normal" exits when driven on the command-line
21
20
  trap(:INT) { exit 130 }
@@ -25,7 +24,7 @@ OptionParser.new('', 24, ' ') do |opts|
25
24
  opts.banner = usage
26
25
  opts.on('-d', '--delay=DELAY', Float) { |n| delay = n }
27
26
  opts.on('-t', '--queued-threshold=INT', Integer) { |n| queued_thresh = n }
28
- opts.on('-a', '--all') { all = true }
27
+ opts.on('-a', '--all') { } # noop
29
28
  opts.parse! ARGV
30
29
  end
31
30
 
@@ -1,5 +1,5 @@
1
1
  # This is a snippet of the config that powers
2
- # http://raindrops-demo.bogomips.org/
2
+ # https://yhbt.net/raindrops-demo/
3
3
  # This may be used with the packaged zbatery.conf.rb
4
4
  #
5
5
  # zbatery -c zbatery.conf.ru watcher_demo.ru -E none
@@ -0,0 +1,30 @@
1
+ # Inlined rack app using yahns server (git clone git://yhbt.net/yahns.git)
2
+ # Usage: yahns -c /path/to/this/file.conf.rb
3
+ # There is no separate config.ru file for this example,
4
+ # but rack_app may also be a string pointing to the path of a
5
+ # config.ru file
6
+
7
+ require 'rack'
8
+ rack_app = Rack::Builder.new do
9
+ use Rack::Head
10
+ addr = %w(0.0.0.0:9418 0.0.0.0:443 [::]:443 0.0.0.0:80 [::]:80
11
+ 127.0.0.1:6081 127.0.0.1:280 0.0.0.0:119 [::]:119)
12
+ use Raindrops::Middleware, listeners: addr
13
+ run Raindrops::Watcher.new(listeners: addr)
14
+ end.to_app
15
+ # rack_app = '/path/to/config.ru' # a more standard config
16
+
17
+ app(:rack, rack_app) do
18
+ # I keep IPv4 and IPv6 on separate sockets to avoid ugly
19
+ # IPv4-mapped-IPv6 addresses:
20
+ listen 8080
21
+ listen '[::]:8080', ipv6only: true
22
+ client_max_body_size 0 # no POST or any uploads
23
+ client_timeout 5
24
+ output_buffering false # needed for /tail/ endpoint to avoid ENOSPC
25
+ queue { worker_threads 30 }
26
+ end
27
+
28
+ # logging is optional, but recommended for diagnosing problems
29
+ # stderr_path '/var/log/yahns/stderr-raindrops.log'
30
+ # stdout_path '/var/log/yahns/stdout-raindrops.log'
@@ -1,6 +1,9 @@
1
1
  # Used for running Raindrops::Watcher, which requires a multi-threaded
2
2
  # Rack server capable of streaming a response. Threads must be used,
3
- # so Zbatery is recommended: http://zbatery.bogomip.org/
3
+ # so any multi-threaded Rack server may be used.
4
+ # zbatery was recommended in the past, but it is abandoned
5
+ # <http://zbatery.bogomip.org/>.
6
+ # yahns may work as an alternative (see yahns.conf.rb in this dir)
4
7
  Rainbows! do
5
8
  use :ThreadSpawn
6
9
  end
@@ -1,4 +1,5 @@
1
1
  require 'mkmf'
2
+ require 'shellwords'
2
3
 
3
4
  dir_config('atomic_ops')
4
5
  have_func('mmap', 'sys/mman.h') or abort 'mmap() not found'
@@ -6,9 +7,112 @@ have_func('munmap', 'sys/mman.h') or abort 'munmap() not found'
6
7
 
7
8
  $CPPFLAGS += " -D_GNU_SOURCE "
8
9
  have_func('mremap', 'sys/mman.h')
10
+ headers = %w(sys/types.h netdb.h string.h sys/socket.h netinet/in.h)
11
+ if have_header('linux/tcp.h')
12
+ headers << 'linux/tcp.h'
13
+ else
14
+ %w(netinet/tcp.h netinet/tcp_fsm.h).each { |h|
15
+ have_header(h, headers) and headers << h
16
+ }
17
+ end
9
18
 
10
19
  $CPPFLAGS += " -D_BSD_SOURCE "
20
+
21
+ if have_type("struct tcp_info", headers)
22
+ %w(
23
+ tcpi_state
24
+ tcpi_ca_state
25
+ tcpi_retransmits
26
+ tcpi_probes
27
+ tcpi_backoff
28
+ tcpi_options
29
+ tcpi_snd_wscale
30
+ tcpi_rcv_wscale
31
+ tcpi_rto
32
+ tcpi_ato
33
+ tcpi_snd_mss
34
+ tcpi_rcv_mss
35
+ tcpi_unacked
36
+ tcpi_sacked
37
+ tcpi_lost
38
+ tcpi_retrans
39
+ tcpi_fackets
40
+ tcpi_last_data_sent
41
+ tcpi_last_ack_sent
42
+ tcpi_last_data_recv
43
+ tcpi_last_ack_recv
44
+ tcpi_pmtu
45
+ tcpi_rcv_ssthresh
46
+ tcpi_rtt
47
+ tcpi_rttvar
48
+ tcpi_snd_ssthresh
49
+ tcpi_snd_cwnd
50
+ tcpi_advmss
51
+ tcpi_reordering
52
+ tcpi_rcv_rtt
53
+ tcpi_rcv_space
54
+ tcpi_total_retrans
55
+ tcpi_snd_wnd
56
+ tcpi_snd_bwnd
57
+ tcpi_snd_nxt
58
+ tcpi_rcv_nxt
59
+ tcpi_toe_tid
60
+ tcpi_snd_rexmitpack
61
+ tcpi_rcv_ooopack
62
+ tcpi_snd_zerowin
63
+ ).each do |field|
64
+ cfunc = "tcp_info_#{field}"
65
+ if have_struct_member('struct tcp_info', field, headers)
66
+ func_body = <<EOF
67
+ static VALUE #{cfunc}(VALUE self)
68
+ {
69
+ struct tcp_info *info = DATA_PTR(self);
70
+ return UINT2NUM((uint32_t)info->#{field});
71
+ }
72
+ EOF
73
+ func_body.delete!("\n")
74
+ $defs << "-DCFUNC_#{cfunc}=#{Shellwords.shellescape(func_body)}"
75
+ else
76
+ func_body = "static inline void #{cfunc}(void) {}"
77
+ $defs << "-DCFUNC_#{cfunc}=#{Shellwords.shellescape(func_body)}"
78
+ cfunc = 'rb_f_notimplement'.freeze
79
+ end
80
+ rbmethod = %Q("#{field.sub(/\Atcpi_/, ''.freeze)}")
81
+ $defs << "-DDEFINE_METHOD_tcp_info_#{field}=" \
82
+ "#{Shellwords.shellescape(
83
+ %Q[rb_define_method(cTCP_Info,#{rbmethod},#{cfunc},0)])}"
84
+ end
85
+ tcp_state_map = {
86
+ ESTABLISHED: %w(TCP_ESTABLISHED TCPS_ESTABLISHED),
87
+ SYN_SENT: %w(TCP_SYN_SENT TCPS_SYN_SENT),
88
+ SYN_RECV: %w(TCP_SYN_RECV TCPS_SYN_RECEIVED),
89
+ FIN_WAIT1: %w(TCP_FIN_WAIT1 TCPS_FIN_WAIT_1),
90
+ FIN_WAIT2: %w(TCP_FIN_WAIT2 TCPS_FIN_WAIT_2),
91
+ TIME_WAIT: %w(TCP_TIME_WAIT TCPS_TIME_WAIT),
92
+ CLOSE: %w(TCP_CLOSE TCPS_CLOSED),
93
+ CLOSE_WAIT: %w(TCP_CLOSE_WAIT TCPS_CLOSE_WAIT),
94
+ LAST_ACK: %w(TCP_LAST_ACK TCPS_LAST_ACK),
95
+ LISTEN: %w(TCP_LISTEN TCPS_LISTEN),
96
+ CLOSING: %w(TCP_CLOSING TCPS_CLOSING),
97
+ }
98
+ nstate = 0
99
+ tcp_state_map.each do |state, try|
100
+ try.each do |os_name|
101
+ have_const(os_name, headers) or next
102
+ tcp_state_map[state] = os_name
103
+ nstate += 1
104
+ end
105
+ end
106
+ if nstate == tcp_state_map.size
107
+ $defs << '-DRAINDROPS_TCP_STATES_ALL_KNOWN=1'
108
+ tcp_state_map.each do |state, name|
109
+ $defs << "-DRAINDROPS_TCP_#{state}=#{name}"
110
+ end
111
+ end
112
+ end
113
+
11
114
  have_func("getpagesize", "unistd.h")
115
+ have_func('rb_thread_call_without_gvl')
12
116
  have_func('rb_thread_blocking_region')
13
117
  have_func('rb_thread_io_blocking_region')
14
118
 
@@ -39,17 +143,18 @@ SRC
39
143
  $defs.push(format("-DHAVE_GCC_ATOMIC_BUILTINS"))
40
144
  true
41
145
  else
42
- prev_cflags = $CFLAGS
146
+ $CFLAGS = prev_cflags
43
147
  false
44
148
  end
45
149
  end
46
150
  end or have_header('atomic_ops.h') or abort <<-SRC
47
151
 
48
152
  libatomic_ops is required if GCC 4+ is not used.
49
- See http://www.hpl.hp.com/research/linux/atomic_ops/
153
+ See https://github.com/ivmai/libatomic_ops
50
154
 
51
155
  Users of Debian-based distros may run:
52
156
 
53
157
  apt-get install libatomic-ops-dev
54
158
  SRC
159
+ create_header # generate extconf.h to avoid excessively long command-line
55
160
  create_makefile('raindrops_ext')