• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


Commit MetaInfo

Revisiondd0c79d4efe19ccdd1b0b36c78e636ae85e1aafe (tree)
Time2014-11-24 23:04:14
AuthorDaigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Log Message

Fixed logout in test/TC_forrk.rb

Change Summary

Incremental Difference

--- a/test/baseclient.rb
+++ b/test/baseclient.rb
@@ -35,21 +35,25 @@ class SocketPlayer
3535
3636 def reader
3737 @thread = Thread.new do
38- Thread.pass
39- loop do
40-# break if @socket.closed?
41- if r = select([@socket], nil, nil, 10)
42- str = r[0].first.gets
43- break if str.nil?
44- @mutex.synchronize do
45- if %r!^[\+\-]\d{4}\w{2},T\d+$! =~ str
46- @received_moves += 1
38+ begin
39+ Thread.pass
40+ loop do
41+ break if @socket.closed?
42+ if r = select([@socket], nil, nil, 10)
43+ str = r[0].first.gets
44+ break if str.nil?
45+ @mutex.synchronize do
46+ if %r!^[\+\-]\d{4}\w{2},T\d+$! =~ str
47+ @received_moves += 1
48+ end
49+ @message << str
4750 end
48- @message << str
51+ else
52+ raise "timed out"
4953 end
50- else
51- raise "timed out"
5254 end
55+ rescue IOError
56+ $stderr.puts "\nReader thread interrupted"
5357 end
5458 end
5559 end
@@ -123,8 +127,8 @@ class SocketPlayer
123127 end
124128
125129 def logout
126- stop_reader
127130 @socket.puts "LOGOUT"
131+ @socket.close
128132 end
129133
130134 end