• 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

Revisão7cd512b50be019cee0d9c000716be2277d50743f (tree)
Hora2020-10-04 23:05:22
AutorMizar <mizar.jp@gmai...>
CommiterMizar

Mensagem de Log

Improved timeout detection for space command
Support for clients that perform SP+LF keep-alive, likes Shogidokoro (version 4.7.1+Test4).

Mudança Sumário

Diff

--- a/shogi_server/command.rb
+++ b/shogi_server/command.rb
@@ -28,7 +28,7 @@ module ShogiServer
2828 def Command.factory(str, player, time=Time.now)
2929 cmd = nil
3030 case str
31- when "", /^%[^%]/, :timeout
31+ when "", /^\s*$/, /^%[^%]/, :timeout
3232 cmd = SpecialCommand.new(str, player)
3333 when /^[\+\-][^%]/
3434 cmd = MoveCommand.new(str, player)
@@ -108,8 +108,6 @@ module ShogiServer
108108 new_buoy_game = nil
109109 nth_move = nil
110110 cmd = ForkCommand.new(str, player, source_game, new_buoy_game, nth_move)
111- when /^\s*$/
112- cmd = SpaceCommand.new(str, player)
113111 when /^%%%[^%]/
114112 # TODO: just ignore commands specific to 81Dojo.
115113 # Need to discuss with 81Dojo people.
@@ -172,7 +170,7 @@ module ShogiServer
172170 end
173171 end
174172
175- # Command like "%TORYO", :timeout, or keep alive
173+ # Command like "%TORYO", :timeout, space, or keep alive
176174 #
177175 # Keep Alive is an application-level protocol. Whenever the server receives
178176 # an LF, it sends back an LF. Note that the 30 sec rule (client may not send
@@ -191,6 +189,9 @@ module ShogiServer
191189 @player.write_safe("\n")
192190 # Fall back to :timeout to check the game gets timed up
193191 @str = :timeout
192+ elsif /^\s+$/ =~ @str
193+ # Fall back to :timeout to check the game gets timed up
194+ @str = :timeout
194195 end
195196
196197 if (@player.status == "game")
@@ -673,19 +674,6 @@ module ShogiServer
673674 end
674675 end
675676
676- # Command for a space
677- #
678- class SpaceCommand < Command
679- def initialize(str, player)
680- super
681- end
682-
683- def call
684- ## ignore null string
685- return :continue
686- end
687- end
688-
689677 # Command for an error
690678 #
691679 class ErrorCommand < Command