shogi-server source
リビジョン | 3ffaeead65a729c5d6203eaf2a56050c3269402b (tree) |
---|---|
日時 | 2014-12-13 16:28:41 |
作者 | Daigo Moriwaki <daigo@debi...> |
コミッター | Daigo Moriwaki |
Merge remote-tracking branch 'origin/wdoor-stable'
Conflicts:
changelog
@@ -1,3 +1,11 @@ | ||
1 | +2014-11-24 Daigo Moriwaki <daigo at debian dot org> | |
2 | + | |
3 | + * Ruby 2.0: | |
4 | + - Ruby 2.0.0 or later is recommended to use with shogi-server | |
5 | + since Ruby 1.8 reached its End-of-Life on the end of July, 2014. | |
6 | + * [shogi-server] | |
7 | + - Addressed a warning of duplicated range in a regular expression. | |
8 | + | |
1 | 9 | 2014-10-13 Daigo Moriwaki <daigo at debian dot org> |
2 | 10 | |
3 | 11 | * [shogi-server] |
@@ -1,4 +1,4 @@ | ||
1 | -#!/usr/bin/ruby1.9.1 | |
1 | +#!/usr/bin/ruby | |
2 | 2 | # $Id$ |
3 | 3 | # |
4 | 4 | # Author:: Daigo Moriwaki |
@@ -50,9 +50,9 @@ | ||
50 | 50 | # |
51 | 51 | # Sample Command lines that isntall prerequires will work on Debian. |
52 | 52 | # |
53 | -# * Ruby 1.9.3 or 1.8.7 including RDoc | |
53 | +# * Ruby 2.0.0 or later including RDoc | |
54 | 54 | # |
55 | -# $ sudo aptitude install ruby ruby1.9.1 | |
55 | +# $ sudo aptitude install ruby ruby | |
56 | 56 | # |
57 | 57 | # == Example |
58 | 58 | # |
@@ -1,4 +1,4 @@ | ||
1 | -#!/usr/bin/ruby1.9.1 | |
1 | +#!/usr/bin/ruby | |
2 | 2 | # $Id$ |
3 | 3 | # |
4 | 4 | # Author:: Daigo Moriwaki |
@@ -35,9 +35,9 @@ | ||
35 | 35 | # |
36 | 36 | # Sample Command lines that isntall prerequires will work on Debian. |
37 | 37 | # |
38 | -# * Ruby 1.9.3 or 1.8.7 | |
38 | +# * Ruby 2.0.0 or later | |
39 | 39 | # |
40 | -# $ sudo aptitude install ruby1.9.1 | |
40 | +# $ sudo aptitude install ruby | |
41 | 41 | # |
42 | 42 | # == Run |
43 | 43 | # |
@@ -1,4 +1,4 @@ | ||
1 | -#!/usr/bin/ruby1.9.1 | |
1 | +#!/usr/bin/ruby | |
2 | 2 | # $Id$ |
3 | 3 | # |
4 | 4 | # Author:: Daigo Moriwaki |
@@ -41,9 +41,9 @@ | ||
41 | 41 | # |
42 | 42 | # == Prerequire |
43 | 43 | # |
44 | -# * Ruby 1.9.3 or 1.8.7 | |
44 | +# * Ruby 2.0.0 or later | |
45 | 45 | # |
46 | -# $ sudo aptitude install ruby ruby1.9.1 | |
46 | +# $ sudo aptitude install ruby ruby | |
47 | 47 | # |
48 | 48 | # == Example |
49 | 49 | # |
@@ -1,4 +1,4 @@ | ||
1 | -#!/usr/bin/ruby1.9.1 | |
1 | +#!/usr/bin/ruby | |
2 | 2 | # $Id$ |
3 | 3 | # |
4 | 4 | # Author:: Daigo Moriwaki |
@@ -76,9 +76,9 @@ | ||
76 | 76 | # |
77 | 77 | # Sample Command lines that install prerequires will work on Debian. |
78 | 78 | # |
79 | -# * Ruby 1.9.3 or 1.8.7 (including Rubygems) | |
79 | +# * Ruby 2.0.0 or later (including Rubygems) | |
80 | 80 | # |
81 | -# $ sudo aptitude install ruby1.9.1 | |
81 | +# $ sudo aptitude install ruby | |
82 | 82 | # |
83 | 83 | # * Ruby bindings for the GNU Scientific Library (GSL[http://rb-gsl.rubyforge.org/]) |
84 | 84 | # |
@@ -86,7 +86,7 @@ | ||
86 | 86 | # |
87 | 87 | # * RGL: {Ruby Graph Library}[http://rubyforge.org/projects/rgl/] |
88 | 88 | # |
89 | -# $ sudo gem1.9.1 install rgl | |
89 | +# $ sudo gem install rgl | |
90 | 90 | # |
91 | 91 | # == Examples |
92 | 92 | # |
@@ -1,4 +1,4 @@ | ||
1 | -#! /usr/bin/ruby1.9.1 | |
1 | +#! /usr/bin/ruby | |
2 | 2 | # $Id$ |
3 | 3 | # |
4 | 4 | # Author:: NABEYA Kenichi, Daigo Moriwaki |
@@ -1,4 +1,4 @@ | ||
1 | -#! /usr/bin/ruby1.9.1 | |
1 | +#! /usr/bin/ruby | |
2 | 2 | # $Id$ |
3 | 3 | # |
4 | 4 | # Author:: Daigo Moriwaki |
@@ -38,7 +38,7 @@ | ||
38 | 38 | # |
39 | 39 | # * {ruby-prof}[http://rubyforge.org/projects/ruby-prof/] |
40 | 40 | # |
41 | -# $ sudo gem1.9.1 install ruby-prof | |
41 | +# $ sudo gem install ruby-prof | |
42 | 42 | # |
43 | 43 | # == Run |
44 | 44 | # |
@@ -79,7 +79,7 @@ class Login | ||
79 | 79 | end |
80 | 80 | |
81 | 81 | def Login.good_identifier?(str) |
82 | - if str =~ /\A[\w\d_@\-\.]{1,#{Max_Identifier_Length}}\z/ | |
82 | + if str =~ /\A[\w@\-\.]{1,#{Max_Identifier_Length}}\z/ | |
83 | 83 | return true |
84 | 84 | else |
85 | 85 | return false |
@@ -35,21 +35,25 @@ class SocketPlayer | ||
35 | 35 | |
36 | 36 | def reader |
37 | 37 | @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 | |
47 | 50 | end |
48 | - @message << str | |
51 | + else | |
52 | + raise "timed out" | |
49 | 53 | end |
50 | - else | |
51 | - raise "timed out" | |
52 | 54 | end |
55 | + rescue IOError | |
56 | + $stderr.puts "\nReader thread interrupted" | |
53 | 57 | end |
54 | 58 | end |
55 | 59 | end |
@@ -123,8 +127,8 @@ class SocketPlayer | ||
123 | 127 | end |
124 | 128 | |
125 | 129 | def logout |
126 | - stop_reader | |
127 | 130 | @socket.puts "LOGOUT" |
131 | + @socket.close | |
128 | 132 | end |
129 | 133 | |
130 | 134 | end |
@@ -1,4 +1,4 @@ | ||
1 | -#!/usr/bin/ruby1.9.1 | |
1 | +#!/usr/bin/ruby | |
2 | 2 | # This program shows statistics of CSA kifu files like following: |
3 | 3 | # - Monthly #games and #players |
4 | 4 | # - Game results |
@@ -1,4 +1,4 @@ | ||
1 | -#!/usr/bin/ruby1.9.1 | |
1 | +#!/usr/bin/ruby | |
2 | 2 | |
3 | 3 | ## Copyright (C) 2007-2012 Daigo Moriwaki <daigo at debian dot org> |
4 | 4 | ## |