* [PATCH 2/3] fixes for newer rubies
2020-01-06 9:54 [PATCH 0/3] misc fixes and a new home Eric Wong
2020-01-06 9:54 ` [PATCH 1/3] ext/raindrops/extconf: fix cflags reset on ancient CC Eric Wong
@ 2020-01-06 9:54 ` Eric Wong
2020-01-06 9:54 ` [PATCH 3/3] replace bogomips.org with yhbt.net Eric Wong
2 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2020-01-06 9:54 UTC (permalink / raw)
To: raindrops-public
Newer rubies have more warnings
---
examples/linux-listener-stats.rb | 3 +--
lib/raindrops/aggregate/pmq.rb | 12 ++++++------
lib/raindrops/linux.rb | 9 ++++-----
test/ipv6_enabled.rb | 8 ++++----
test/test_linux.rb | 5 +++--
test/test_linux_all_tcp_listen_stats_leak.rb | 4 ++--
test/test_raindrops.rb | 2 +-
test/test_tcp_info.rb | 8 ++++----
test/test_watcher.rb | 18 +++++++++---------
9 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/examples/linux-listener-stats.rb b/examples/linux-listener-stats.rb
index 1008995..7e767da 100755
--- a/examples/linux-listener-stats.rb
+++ b/examples/linux-listener-stats.rb
@@ -15,7 +15,6 @@
usage = "Usage: #$0 [-d DELAY] [-t QUEUED_THRESHOLD] ADDR..."
ARGV.size > 0 or abort usage
delay = false
-all = false
queued_thresh = -1
# "normal" exits when driven on the command-line
trap(:INT) { exit 130 }
@@ -25,7 +24,7 @@
opts.banner = usage
opts.on('-d', '--delay=DELAY', Float) { |n| delay = n }
opts.on('-t', '--queued-threshold=INT', Integer) { |n| queued_thresh = n }
- opts.on('-a', '--all') { all = true }
+ opts.on('-a', '--all') { } # noop
opts.parse! ARGV
end
diff --git a/lib/raindrops/aggregate/pmq.rb b/lib/raindrops/aggregate/pmq.rb
index 8623cb1..64d0a4f 100644
--- a/lib/raindrops/aggregate/pmq.rb
+++ b/lib/raindrops/aggregate/pmq.rb
@@ -142,8 +142,8 @@ def master_loop
warn "Unhandled exception in #{__FILE__}:#{__LINE__}: #{e}"
break
end while true
- ensure
- flush_master
+ ensure
+ flush_master
end
# Loads the last shared \Aggregate from the master thread/process
@@ -175,14 +175,14 @@ def flush_master
# worker thread or process
def stop_master_loop
sleep 0.1 until mq_send(false)
- rescue Errno::EINTR
- retry
+ rescue Errno::EINTR
+ retry
end
def lock! io, type # :nodoc:
io.fcntl Fcntl::F_SETLKW, type
- rescue Errno::EINTR
- retry
+ rescue Errno::EINTR
+ retry
end
# we use both a mutex for thread-safety and fcntl lock for process-safety
diff --git a/lib/raindrops/linux.rb b/lib/raindrops/linux.rb
index 4166ec7..9842ae1 100644
--- a/lib/raindrops/linux.rb
+++ b/lib/raindrops/linux.rb
@@ -14,8 +14,7 @@ module Raindrops::Linux
# The standard proc path for active UNIX domain sockets, feel free to call
# String#replace on this if your /proc is mounted in a non-standard location
# for whatever reason
- PROC_NET_UNIX_ARGS = %w(/proc/net/unix)
- defined?(::Encoding) and PROC_NET_UNIX_ARGS.push({ :encoding => "binary" })
+ PROC_NET_UNIX_ARGS = [ '/proc/net/unix', { encoding: "binary" }]
# Get ListenStats from an array of +paths+
#
@@ -42,11 +41,11 @@ def unix_listener_stats(paths = nil)
else
paths = paths.map do |path|
path = path.dup
- path.force_encoding(Encoding::BINARY) if defined?(Encoding)
+ path.force_encoding(Encoding::BINARY)
if File.symlink?(path)
link = path
path = File.readlink(link)
- path.force_encoding(Encoding::BINARY) if defined?(Encoding)
+ path.force_encoding(Encoding::BINARY)
rv[link] = rv[path] # vivify ListenerStats
else
rv[path] # vivify ListenerStats
@@ -57,7 +56,7 @@ def unix_listener_stats(paths = nil)
paths = /^\w+: \d+ \d+ (\d+) \d+ (\d+)\s+\d+ (#{paths.join('|')})$/n
# no point in pread since we can't stat for size on this file
- File.read(*PROC_NET_UNIX_ARGS).scan(paths) do |s|
+ File.read(PROC_NET_UNIX_ARGS[0], encoding: 'binary').scan(paths) do |s|
path = s[-1]
case s[0]
when "00000000" # client sockets
diff --git a/test/ipv6_enabled.rb b/test/ipv6_enabled.rb
index f02b48f..c4c9709 100644
--- a/test/ipv6_enabled.rb
+++ b/test/ipv6_enabled.rb
@@ -2,8 +2,8 @@ def ipv6_enabled?
tmp = TCPServer.new(ENV["TEST_HOST6"] || '::1', 0)
tmp.close
true
- rescue => e
- warn "skipping IPv6 tests, host does not seem to be IPv6 enabled:"
- warn " #{e.class}: #{e}"
- false
+rescue => e
+ warn "skipping IPv6 tests, host does not seem to be IPv6 enabled:"
+ warn " #{e.class}: #{e}"
+ false
end
diff --git a/test/test_linux.rb b/test/test_linux.rb
index bfefcc4..7808469 100644
--- a/test/test_linux.rb
+++ b/test/test_linux.rb
@@ -76,6 +76,7 @@ def test_unix_all_unused
assert_equal 0, stats[tmp.path].active
assert_equal 0, stats[tmp.path].queued
+ us.close
end
def test_unix_resolves_symlinks
@@ -151,8 +152,8 @@ def test_tcp_reuse_sock
assert_equal 1, stats.size
assert_equal 0, stats[addr].queued
assert_equal 1, stats[addr].active
- ensure
- nlsock.close
+ ensure
+ nlsock.close
end
def test_tcp_multi
diff --git a/test/test_linux_all_tcp_listen_stats_leak.rb b/test/test_linux_all_tcp_listen_stats_leak.rb
index 7368220..7be46d4 100644
--- a/test/test_linux_all_tcp_listen_stats_leak.rb
+++ b/test/test_linux_all_tcp_listen_stats_leak.rb
@@ -37,7 +37,7 @@ def test_leak
end
cur_kb = rss_kb
p [ :cur_kb, cur_kb ]
- ensure
- s.close
+ ensure
+ s.close
end
end if ENV["STRESS"].to_i != 0
diff --git a/test/test_raindrops.rb b/test/test_raindrops.rb
index 67089b7..0749694 100644
--- a/test/test_raindrops.rb
+++ b/test/test_raindrops.rb
@@ -134,7 +134,7 @@ def test_resize_mremap
assert_equal 0, rd[rd.capa - 1]
assert_equal 1, rd.incr(rd.capa - 1)
assert_raises(ArgumentError) { rd[rd.capa] }
- rescue RangeError
+ rescue RangeError
end # if RUBY_PLATFORM =~ /linux/
def test_evaporate
diff --git a/test/test_tcp_info.rb b/test/test_tcp_info.rb
index b107565..2ddacfd 100644
--- a/test/test_tcp_info.rb
+++ b/test/test_tcp_info.rb
@@ -60,10 +60,10 @@ def test_tcp_server_delayed
a = s.accept
i = Raindrops::TCP_Info.new(a)
assert i.last_data_recv >= delay_ms, "#{i.last_data_recv} < #{delay_ms}"
- ensure
- c.close if c
- a.close if a
- s.close
+ ensure
+ c.close if c
+ a.close if a
+ s.close
end
def test_tcp_server_state_closed
diff --git a/test/test_watcher.rb b/test/test_watcher.rb
index d1e4d15..28ac49b 100644
--- a/test/test_watcher.rb
+++ b/test/test_watcher.rb
@@ -118,28 +118,28 @@ def test_tail_queued_min
def test_x_current_header
env = @req.class.env_for "/active/#@addr.txt"
- status, headers, body = @app.call(env)
+ _status, headers, _body = @app.call(env)
assert_equal "0", headers["X-Current"], headers.inspect
env = @req.class.env_for "/queued/#@addr.txt"
- status, headers, body = @app.call(env)
+ _status, headers, _body = @app.call(env)
assert_equal "1", headers["X-Current"], headers.inspect
@ios << @srv.accept
sleep 0.1
env = @req.class.env_for "/queued/#@addr.txt"
- status, headers, body = @app.call(env)
+ _status, headers, _body = @app.call(env)
assert_equal "0", headers["X-Current"], headers.inspect
env = @req.class.env_for "/active/#@addr.txt"
- status, headers, body = @app.call(env)
+ _status, headers, _body = @app.call(env)
assert_equal "1", headers["X-Current"], headers.inspect
end
def test_peaks
env = @req.class.env_for "/active/#@addr.txt"
- status, headers, body = @app.call(env.dup)
+ _status, headers, _body = @app.call(env.dup)
start = headers["X-First-Peak-At"]
assert headers["X-First-Peak-At"], headers.inspect
assert headers["X-Last-Peak-At"], headers.inspect
@@ -148,14 +148,14 @@ def test_peaks
before = headers["X-Last-Peak-At"]
env = @req.class.env_for "/queued/#@addr.txt"
- status, headers, body = @app.call(env)
+ _status, headers, _body = @app.call(env)
assert_nothing_raised { Time.parse(headers["X-First-Peak-At"]) }
assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
assert_equal before, headers["X-Last-Peak-At"], "should not change"
sleep 2
env = @req.class.env_for "/active/#@addr.txt"
- status, headers, body = @app.call(env.dup)
+ _status, headers, _body = @app.call(env.dup)
assert_equal before, headers["X-Last-Peak-At"], headers.inspect
@ios << @srv.accept
@@ -167,7 +167,7 @@ def test_peaks
end
sleep 0.1
env = @req.class.env_for "/queued/#@addr.txt"
- status, headers, body = @app.call(env.dup)
+ _status, headers, _body = @app.call(env.dup)
assert headers["X-Last-Peak-At"], headers.inspect
assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
assert before != headers["X-Last-Peak-At"]
@@ -177,7 +177,7 @@ def test_peaks
sleep 2
env = @req.class.env_for "/queued/#@addr.txt"
- status, headers, body = @app.call(env)
+ _status, headers, _body = @app.call(env)
assert_equal "0", headers["X-Current"]
assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
assert_equal queued_before, headers["X-Last-Peak-At"], "should not change"
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] replace bogomips.org with yhbt.net
2020-01-06 9:54 [PATCH 0/3] misc fixes and a new home Eric Wong
2020-01-06 9:54 ` [PATCH 1/3] ext/raindrops/extconf: fix cflags reset on ancient CC Eric Wong
2020-01-06 9:54 ` [PATCH 2/3] fixes for newer rubies Eric Wong
@ 2020-01-06 9:54 ` Eric Wong
2020-01-06 10:17 ` Eric Wong
2 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2020-01-06 9:54 UTC (permalink / raw)
To: raindrops-public
The expiration for bogomips.org is coming up and I'm not
keen on paying or supporting extortionists.
Not wanting to be beholden to ICANN or any powerful
organizations, .onion sites are available to Tor users:
http://raindrops.ou63pmih66umazou.onion/
http://ou63pmih66umazou.onion/raindrops.git/
http://ou63pmih66umazou.onion/raindrops-public/
(the demo is not yet available via .onion, yet, could be a bit)
---
.olddoc.yml | 12 +++++-------
GNUmakefile | 2 +-
README | 11 ++++++-----
examples/watcher_demo.ru | 2 +-
ext/raindrops/linux_inet_diag.c | 2 +-
lib/raindrops.rb | 2 +-
lib/raindrops/middleware.rb | 4 ++--
lib/raindrops/watcher.rb | 14 +++++++-------
raindrops.gemspec | 4 ++--
9 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/.olddoc.yml b/.olddoc.yml
index 9792974..015e0e5 100644
--- a/.olddoc.yml
+++ b/.olddoc.yml
@@ -1,14 +1,12 @@
---
-cgit_url: https://bogomips.org/raindrops.git
-git_url: git://bogomips.org/raindrops.git
-rdoc_url: https://bogomips.org/raindrops/
-public_email: raindrops-public@bogomips.org
+rdoc_url: https://yhbt.net/raindrops/
+public_email: raindrops-public@yhbt.net
ml_url:
-- https://bogomips.org/raindrops-public/
+- https://yhbt.net/raindrops-public/
- http://ou63pmih66umazou.onion/raindrops-public
nntp_url:
- nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
- nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops
source_code:
-- git clone git://bogomips.org/raindrops.git
-- git clone https://bogomips.org/raindrops.git
+- git clone https://yhbt.net/raindrops.git
+- torsocks git clone http://ou63pmih66umazou.onion/raindrops.git
diff --git a/GNUmakefile b/GNUmakefile
index 9f833be..f89c3c2 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,4 +1,4 @@
all::
-RSYNC_DEST := bogomips.org:/srv/bogomips/raindrops
+RSYNC_DEST := yhbt.net:/srv/yhbt/raindrops
rfpackage := raindrops
include pkg.mk
diff --git a/README b/README
index 723d125..d8e9636 100644
--- a/README
+++ b/README
@@ -59,20 +59,20 @@ If you use RubyGems:
See Raindrops::Middleware and Raindrops::LastDataRecv documentation for
use Rack servers. The entire library is fully-documented and we are
responsive on the publically archived mailing list
-(mailto:raindrops-public@bogomips.org) if
+(mailto:raindrops-public@yhbt.net) if
you have any questions or comments.
== Development
You can get the latest source via git from the following locations:
- git://bogomips.org/raindrops.git
+ git://yhbt.net/raindrops.git
git://repo.or.cz/raindrops.git (mirror)
You may browse the code from the web and download the latest snapshot
tarballs here:
-* https://bogomips.org/raindrops.git
+* https://yhbt.net/raindrops.git
* http://repo.or.cz/w/raindrops.git (gitweb)
Inline patches (from "git format-patch") to the mailing list are
@@ -90,11 +90,12 @@ raindrops is licensed under the LGPL-2.1+
All feedback (bug reports, user/development discussion, patches, pull
requests) go to the publically archived mailing list:
-mailto:raindrops-public@bogomips.org
+mailto:raindrops-public@yhbt.net
Mailing list archives are available over HTTPS and NNTP:
-* https://bogomips.org/raindrops-public/
+* https://yhbt.net/raindrops-public/
+* http://ou63pmih66umazou.onion/raindrops-public/
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
Since archives are public, scrub sensitive information and
diff --git a/examples/watcher_demo.ru b/examples/watcher_demo.ru
index 7adba8e..91f4cca 100644
--- a/examples/watcher_demo.ru
+++ b/examples/watcher_demo.ru
@@ -1,5 +1,5 @@
# This is a snippet of the config that powers
-# https://raindrops-demo.bogomips.org/
+# https://yhbt.net/raindrops-demo/
# This may be used with the packaged zbatery.conf.rb
#
# zbatery -c zbatery.conf.ru watcher_demo.ru -E none
diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c
index 615c931..60c80f1 100644
--- a/ext/raindrops/linux_inet_diag.c
+++ b/ext/raindrops/linux_inet_diag.c
@@ -205,7 +205,7 @@ static void bug_warn_nogvl(const char *fmt, ...)
va_end(ap);
fprintf(stderr, "Please report how you produced this at "\
- "raindrops-public@bogomips.org\n");
+ "raindrops-public@yhbt.net\n");
fflush(stderr);
}
diff --git a/lib/raindrops.rb b/lib/raindrops.rb
index d3913a8..ba273eb 100644
--- a/lib/raindrops.rb
+++ b/lib/raindrops.rb
@@ -12,7 +12,7 @@
# Unlike many classes in this package, the core Raindrops class is
# intended to be portable to all reasonably modern *nix systems
# supporting mmap(). Please let us know if you have portability
-# issues, patches or pull requests at mailto:raindrops-public@bogomips.org
+# issues, patches or pull requests at mailto:raindrops-public@yhbt.net
class Raindrops
# Used to represent the number of +active+ and +queued+ sockets for
diff --git a/lib/raindrops/middleware.rb b/lib/raindrops/middleware.rb
index ea7f08a..d5e3927 100644
--- a/lib/raindrops/middleware.rb
+++ b/lib/raindrops/middleware.rb
@@ -62,9 +62,9 @@
# = Demo Server
#
# There is a server running this middleware (and Watcher) at
-# https://raindrops-demo.bogomips.org/_raindrops
+# https://yhbt.net/raindrops-demo/_raindrops
#
-# Also check out the Watcher demo at https://raindrops-demo.bogomips.org/
+# Also check out the Watcher demo at https://yhbt.net/raindrops-demo/
#
# The demo server is only limited to 30 users, so be sure not to abuse it
# by using the /tail/ endpoint too much.
diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb
index b0615f7..ac5b895 100644
--- a/lib/raindrops/watcher.rb
+++ b/lib/raindrops/watcher.rb
@@ -35,28 +35,28 @@
# Returns a plain text summary + histogram with X-* HTTP headers for
# active connections.
#
-# e.g.: curl https://raindrops-demo.bogomips.org/active/0.0.0.0%3A80.txt
+# e.g.: curl https://yhbt.net/raindrops-demo/active/0.0.0.0%3A80.txt
#
# === GET /active/$LISTENER.html
#
# Returns an HTML summary + histogram with X-* HTTP headers for
# active connections.
#
-# e.g.: curl https://raindrops-demo.bogomips.org/active/0.0.0.0%3A80.html
+# e.g.: curl https://yhbt.net/raindrops-demo/active/0.0.0.0%3A80.html
#
# === GET /queued/$LISTENER.txt
#
# Returns a plain text summary + histogram with X-* HTTP headers for
# queued connections.
#
-# e.g.: curl https://raindrops-demo.bogomips.org/queued/0.0.0.0%3A80.txt
+# e.g.: curl https://yhbt.net/raindrops-demo/queued/0.0.0.0%3A80.txt
#
# === GET /queued/$LISTENER.html
#
# Returns an HTML summary + histogram with X-* HTTP headers for
# queued connections.
#
-# e.g.: curl https://raindrops-demo.bogomips.org/queued/0.0.0.0%3A80.html
+# e.g.: curl https://yhbt.net/raindrops-demo/queued/0.0.0.0%3A80.html
#
# === POST /reset/$LISTENER
#
@@ -95,9 +95,9 @@
#
# = Demo Server
#
-# There is a server running this app at https://raindrops-demo.bogomips.org/
+# There is a server running this app at https://yhbt.net/raindrops-demo/
# The Raindrops::Middleware demo is also accessible at
-# https://raindrops-demo.bogomips.org/_raindrops
+# https://yhbt.net/raindrops-demo/_raindrops
#
# The demo server is only limited to 30 users, so be sure not to abuse it
# by using the /tail/ endpoint too much.
@@ -106,7 +106,7 @@ class Raindrops::Watcher
attr_reader :snapshot
include Rack::Utils
include Raindrops::Linux
- DOC_URL = "https://bogomips.org/raindrops/Raindrops/Watcher.html"
+ DOC_URL = "https://yhbt.net/raindrops/Raindrops/Watcher.html"
Peak = Struct.new(:first, :last)
def initialize(opts = {})
diff --git a/raindrops.gemspec b/raindrops.gemspec
index 80ee957..1de56a0 100644
--- a/raindrops.gemspec
+++ b/raindrops.gemspec
@@ -8,13 +8,13 @@
s.version = (ENV["VERSION"] ||= '0.18.0').dup
s.authors = ["raindrops hackers"]
s.description = File.read('README').split("\n\n")[1]
- s.email = %q{raindrops-public@bogomips.org}
+ s.email = %q{raindrops-public@yhbt.net}
s.extensions = %w(ext/raindrops/extconf.rb)
s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
File.exist?(f)
end
s.files = manifest
- s.homepage = 'https://bogomips.org/raindrops/'
+ s.homepage = 'https://yhbt.net/raindrops/'
s.summary = 'real-time stats for preforking Rack servers'
s.required_ruby_version = '>= 1.9.3'
s.test_files = test_files
^ permalink raw reply related [flat|nested] 5+ messages in thread