OSDN Git Service

Set initial values to BasicPlayer's instance variables.
[shogi-server/shogi-server.git] / shogi_server / player.rb
index 3302aa7..3a86c96 100644 (file)
@@ -30,6 +30,8 @@ class BasicPlayer
     @win  = 0
     @loss = 0
     @last_game_win = false
+    @rating_group = nil
+    @modified_at = nil
     @sente = nil
     @game_name = ""
   end
@@ -192,6 +194,7 @@ class Player < BasicPlayer
         log_debug("Terminating %s's write thread..." % [@name])
         if @write_thread && @write_thread.alive?
           write_safe(nil)
+          Thread.pass # help the write_thread to terminate
         end
         @player_logger.close if @player_logger
         log_debug("done.")
@@ -300,6 +303,7 @@ class Player < BasicPlayer
         $mutex.unlock
       end
     end # enf of while
+    log_warning("%s's socket was suddenly closed" % [@name])
   end # def run
 end # class