Permalink
Browse files

Merge commit 'solfo/master'

Conflicts:

	lib/Combust/Control.pm
  • Loading branch information...
2 parents 42ad3c5 + cf75aa3 commit d11d64fd82597483496cd505823a873b23cbba1f @abh committed Oct 12, 2008
Showing with 44 additions and 8 deletions.
  1. +1 −0 bin/cmysql
  2. +16 −0 bin/diff_cpan_arch
  3. +1 −2 lib/Combust/Control.pm
  4. +2 −0 lib/Combust/Logger.pm
  5. +24 −6 lib/Combust/RoseDB.pm
View
1 bin/cmysql
@@ -94,6 +94,7 @@ else {
else {
close(RDR);
print WTR "[client]\npassword=$passwd\n";
+ print WTR "default-character-set=utf8\n";
close(WTR);
exit 0;
}
View
16 bin/diff_cpan_arch
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+do_diff() {
+ while [ $# -ge 2 ]; do
+ diff -u --label $1 --label $2 \
+ <( cd $1 ; find . -name \*.pm | sort | xargs md5sum ) \
+ <( cd $2 ; find . -name \*.pm | sort | xargs md5sum )
+ shift
+ done
+}
+
+cd $CBROOTLOCAL/cpan/lib/perl5
+
+do_diff *-*
+
+
View
3 lib/Combust/Control.pm
@@ -425,10 +425,9 @@ sub redirect {
my $url_escaped = uri_escape($url);
- # TODO: don't we end up double escaping here?
my $data = <<EOH;
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
-<HTML><HEAD><TITLE>Redirect Found</TITLE></HEAD><BODY><A HREF="$url_escaped">here</A>.<P></BODY></HTML>
+<HTML><HEAD><TITLE>Redirect...</TITLE></HEAD><BODY>The document has moved <A HREF="$url_escaped">here</A>.<P></BODY></HTML>
EOH
$self->request->header_out('Content-Length' => length($data));
View
2 lib/Combust/Logger.pm
@@ -37,6 +37,7 @@ our $saywarn = 0;
our $done_syslog;
our $LogToFile;
our $ShowExitBanner;
+our %Count;
my @orig_argv;
@@ -76,6 +77,7 @@ sub logconfig {
sub _syslog {
my $type = shift;
+ ++$Count{$type};
return unless $do_syslog or $type eq 'alert';
_openlog() unless $opened;
syslog($type, "%s", $_) for (split /\r?\n/, $_[0]);
View
30 lib/Combust/RoseDB.pm
@@ -81,7 +81,7 @@ sub ping {
my $up = $dbh && $dbh->ping;
my $new_thread_id = $up && $dbh->{mysql_thread_id};
- if ($thread_id) {
+ if ($thread_id) { # Last check connection was ok
unless ($up) {
$self->dbh(undef); # Force re-connect
$dbh = eval { local $SIG{__DIE__}; $self->dbh };
@@ -96,24 +96,42 @@ sub ping {
return DB_BOUNCED;
}
}
- elsif ( defined $thread_id ) {
+ elsif ( defined $thread_id ) { # Last check connection was down
if ($up) {
$self->combust_thread_id($new_thread_id);
Combust::Logger::logwarn( "Reconnected database connection to '" . $self->type . "'\n" );
return DB_BOUNCED;
}
}
- else {
+ else { # First time through
if ($up) {
$self->combust_thread_id($new_thread_id);
- return $dbh->{auto_reconnects_ok} ? DB_BOUNCED : DB_UP;
+ if ( $dbh->{auto_reconnects_ok} ) {
+ Combust::Logger::logwarn( "Bounced database connection to '" . $self->type . "'\n" );
+ return DB_BOUNCED;
+ }
+ else {
+ return DB_UP;
+ }
+ }
+ else {
+ $self->dbh(undef); # Force re-connect
+ $dbh = eval { local $SIG{__DIE__}; $self->dbh };
+ $up = $dbh && $dbh->ping;
+ if ($up) {
+ $new_thread_id = $dbh->{mysql_thread_id};
+ $self->combust_thread_id($new_thread_id);
+ Combust::Logger::logwarn( "Bounced database connection to '" . $self->type . "'\n" );
+ return DB_BOUNCED;
+ }
}
}
- $self->combust_thread_id(0); # Signal connection as down
+ $self->combust_thread_id(0); # Signal connection as down
+ $self->dbh(undef); # Force re-connect
Combust::Logger::logwarn( "Lost database connection to '" . $self->type . "'\n" )
- if $thread_id or !defined($thread_id);
+ if ($thread_id or !defined($thread_id));
return DB_DOWN;
}

0 comments on commit d11d64f

Please sign in to comment.