about summary refs log tree commit homepage
path: root/examples
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-03-12 12:56:15 -0800
committerEric Wong <normalperson@yhbt.net>2011-03-12 20:56:50 +0000
commitc478549ea7490de2432ed31ffee37a2bfc1d24f3 (patch)
treec4998b538dbfe13840bb527952e689c6d213d5c7 /examples
parenta4b9c8334e2bc0698f0650d275be0935e86dc13e (diff)
downloadraindrops-c478549ea7490de2432ed31ffee37a2bfc1d24f3.tar.gz
No need to waste resources on creating/destroying
a socket.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/linux-listener-stats.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/linux-listener-stats.rb b/examples/linux-listener-stats.rb
index 5826296..70d60c6 100755
--- a/examples/linux-listener-stats.rb
+++ b/examples/linux-listener-stats.rb
@@ -79,6 +79,7 @@ end
 combined = {}
 tcp = nil if tcp.empty?
 unix = nil if unix.empty?
+sock = Raindrops::InetDiagSocket.new if tcp
 
 len = 35 if len > 35
 fmt = "%20s % #{len}s % 10u % 10u\n"
@@ -89,7 +90,7 @@ begin
     combined.clear
     now = nil
   end
-  tcp and combined.merge! Raindrops::Linux.tcp_listener_stats(tcp)
+  tcp and combined.merge! Raindrops::Linux.tcp_listener_stats(tcp, sock)
   unix and combined.merge! Raindrops::Linux.unix_listener_stats(unix)
   combined.each do |addr,stats|
     active, queued = stats.active, stats.queued