shogi-server source
修订版 | 23b86a817f3f84768ef05872c5176cb4e7fc6165 (tree) |
---|---|
时间 | 2020-12-14 20:42:55 |
作者 | Mizar <mizar.jp@gmai...> |
Commiter | Mizar |
ignore second select (for windows issue)
@@ -717,7 +717,7 @@ end | ||
717 | 717 | # |
718 | 718 | def main_loop |
719 | 719 | while true |
720 | - ret, = select([$server, $engine], nil, nil, 60) | |
720 | + ret, = select([$engine, $server], nil, nil, 60) | |
721 | 721 | unless ret |
722 | 722 | # Send keep-alive |
723 | 723 | if $bridge_state.too_quiet? |
@@ -727,13 +727,13 @@ def main_loop | ||
727 | 727 | next |
728 | 728 | end |
729 | 729 | |
730 | - ret.each do |io| | |
731 | - case io | |
732 | - when $engine | |
733 | - $bridge_state.do_engine_recv | |
734 | - when $server | |
735 | - $bridge_state.do_sever_recv | |
736 | - end | |
730 | + # Ignore false notifications that both $engine and $server are available, | |
731 | + # even if $server has no incoming data (Occurs on Windows) | |
732 | + case ret[0] | |
733 | + when $engine | |
734 | + $bridge_state.do_engine_recv | |
735 | + when $server | |
736 | + $bridge_state.do_sever_recv | |
737 | 737 | end |
738 | 738 | |
739 | 739 | if $bridge_state.GAME_END? |
@@ -745,7 +745,7 @@ def main_loop | ||
745 | 745 | |
746 | 746 | if $engine.nil? |
747 | 747 | $engine.close |
748 | - $engile = nil | |
748 | + $engine = nil | |
749 | 749 | end |
750 | 750 | |
751 | 751 | if $server.nil? |