summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-06 09:47:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-06 09:47:08 +0000
commit7b7c03717949dbe5c41631bbf02652b251d02636 (patch)
treed1a1f3477269afcf2712463ea131713c75bf44e1 /sample
parent2e0680f22100e8fc46c8efb43ff1a1b875a9e306 (diff)
* object.c (rb_obj_pattern_match): now returns nil.
[ruby-core:05391] * sample/svr.rb: service can be stopped by ill-behaved client; use tsvr.rb instead. * missing/erf.c: original erf.c by prof. Okumura is confirmed to be public domain. reverted BSD implementation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/svr.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/sample/svr.rb b/sample/svr.rb
index 6169861abc..11cfc5fbfe 100644
--- a/sample/svr.rb
+++ b/sample/svr.rb
@@ -1,6 +1,9 @@
# socket example - server side
# usage: ruby svr.rb
+# this server might be blocked by an ill-behaved client.
+# see tsvr.rb which is safe from client blocking.
+
require "socket"
gs = TCPserver.open(0)
@@ -22,10 +25,9 @@ loop do
print(s, " is gone\n")
s.close
socks.delete(s)
- else
- if str = s.gets
+ # single thread gets may block whole service
+ elsif str = s.gets
s.write(str)
- end
end
end
end