From: beatles Date: Sun, 15 Nov 2009 13:24:43 +0000 (+0000) Subject: In a case of the Errno::ECONNRESET error, the error is correctly logged to the server... X-Git-Tag: 20170902~150 X-Git-Url: http://git.sourceforge.jp/view?p=shogi-server%2Fshogi-server.git;a=commitdiff_plain;h=8ce6e11bef2f8e46de3816e465a7c127115c4bc1;ds=inline In a case of the Errno::ECONNRESET error, the error is correctly logged to the server log file. --- diff --git a/shogi-server b/shogi-server index adc18bc..3595fc3 100755 --- a/shogi-server +++ b/shogi-server @@ -252,7 +252,14 @@ def login_loop(client) player = login = nil while r = select([client], nil, nil, ShogiServer::Login_Time) do - break unless str = r[0].first.gets + str = nil + begin + break unless str = r[0].first.gets + rescue Exception => ex + # It is posssible that the socket causes an error (ex. Errno::ECONNRESET) + log_error("login_loop: #{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}") + break + end $mutex.lock # guards $league begin str =~ /([\r\n]*)$/