From 04594cfadbfffceb087e1151f8b81255108d5211 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 Sep 2005 05:43:46 +0000 Subject: [PATCH] Fixed "connection lost" issue with the bundled Ruby/MySQL driver (would kill the app after 8 hours of inactivity) #2163, #428 [kajism@yahoo.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2182 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 2 ++ activerecord/lib/active_record/vendor/mysql.rb | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index d3690eb92f..2122c58fde 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed "connection lost" issue with the bundled Ruby/MySQL driver (would kill the app after 8 hours of inactivity) #2163, #428 [kajism@yahoo.com] + * Fixed comparison of Active Record objects so two new objects are not equal #2099 [deberg] * Fixed that the SQL Server adapter would sometimes return DBI::Timestamp objects instead of Time #2127 [Tom Ward] diff --git a/activerecord/lib/active_record/vendor/mysql.rb b/activerecord/lib/active_record/vendor/mysql.rb index 84f5d2533c..39ceb607b0 100644 --- a/activerecord/lib/active_record/vendor/mysql.rb +++ b/activerecord/lib/active_record/vendor/mysql.rb @@ -1022,6 +1022,9 @@ class Mysql end @sock.sync = true buf.join + rescue + errno = Error::CR_SERVER_LOST + raise Error::new(errno, Error::err(errno)) end def write(data) @@ -1039,6 +1042,9 @@ class Mysql @pkt_nr = @pkt_nr + 1 & 0xff @sock.sync = true @sock.flush + rescue + errno = Error::CR_SERVER_LOST + raise Error::new(errno, Error::err(errno)) end def close()