OSDN Git Service

In a case of the Errno::ECONNRESET error, the error is correctly logged to the server...
authorbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 15 Nov 2009 13:24:43 +0000 (13:24 +0000)
committerbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 15 Nov 2009 13:24:43 +0000 (13:24 +0000)
shogi-server

index adc18bc..3595fc3 100755 (executable)
@@ -252,7 +252,14 @@ def login_loop(client)
   player = login = nil
  
   while r = select([client], nil, nil, ShogiServer::Login_Time) do
   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]*)$/
     $mutex.lock # guards $league
     begin
       str =~ /([\r\n]*)$/