OSDN Git Service

- shogi-server: Improved fault tolerance of the server.
authordaigo <beatles@users.sourceforge.jp>
Sun, 25 Jul 2010 08:43:31 +0000 (17:43 +0900)
committerDaigo Moriwaki <daigo@debian.org>
Sun, 25 Jul 2010 08:43:31 +0000 (17:43 +0900)
changelog
shogi-server

index ad41df3..2af9b67 100644 (file)
--- a/changelog
+++ b/changelog
@@ -11,6 +11,8 @@
            + Fixed race condition: creating a new directory to archive
              logs may have caused race condition, which ended up with
              making the server unavailable. This issue has been fixed. 
+         - shogi-server:
+           + Improved fault tolerance of the server.
 
 2010-07-23  Daigo Moriwaki <daigo at debian dot org>
 
index 750fa6a..c4573c6 100755 (executable)
@@ -415,6 +415,7 @@ def main
   log_message("server started [Revision: #{ShogiServer::Revision}]")
 
   server.start do |client|
+    begin
       # client.sync = true # this is already set in WEBrick 
       client.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
         # Keepalive time can be set by /proc/sys/net/ipv4/tcp_keepalive_time
@@ -436,6 +437,9 @@ def main
       ensure
         $mutex.unlock
       end
+    rescue Exception => ex
+      log_error("server.start: #{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}")
+    end
   end
 end