changeset 152:a389c77da9fd live

* Debug output; trying to trace intermittent DBI errors
author Chris Cannam
date Tue, 25 Jan 2011 11:48:49 +0000
parents e47742d68d2d
children 6d10c3b6fe17
files extra/svn/SoundSoftware.pm
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/extra/svn/SoundSoftware.pm	Mon Jan 24 14:03:13 2011 +0000
+++ b/extra/svn/SoundSoftware.pm	Tue Jan 25 11:48:49 2011 +0000
@@ -160,7 +160,7 @@
 sub access_handler {
     my $r = shift;
 
-    print STDERR "SoundSoftware.pm: In access handler\n";
+    print STDERR "SoundSoftware.pm: In access handler at " . scalar localtime() . "\n";
 
     unless ($r->some_auth_required) {
 	$r->log_reason("No authentication has been configured");
@@ -178,6 +178,13 @@
     }
 
     my $dbh = connect_database($r);
+    unless ($dbh) {
+	print STDERR "SoundSoftware.pm: Database connection failed!: " . $DBI::errstr . "\n";
+	return FORBIDDEN;
+    }
+
+
+print STDERR "Connected to db, dbh is " . $dbh . "\n";
 
     my $project_id = get_project_identifier($dbh, $r);
     my $status = get_project_status($dbh, $project_id, $r);
@@ -201,9 +208,13 @@
 sub authen_handler {
     my $r = shift;
     
-    print STDERR "SoundSoftware.pm: In authentication handler\n";
+    print STDERR "SoundSoftware.pm: In authentication handler at " . scalar localtime() . "\n";
 
     my $dbh = connect_database($r);
+    unless ($dbh) {
+        print STDERR "SoundSoftware.pm: Database connection failed!: " . $DBI::errstr . "\n";
+        return AUTH_REQUIRED;
+    }
     
     my $project_id = get_project_identifier($dbh, $r);
     my $realm = get_realm($dbh, $project_id, $r);
@@ -415,8 +426,8 @@
 	(__PACKAGE__, $r->server, $r->per_dir_config);
 
     return DBI->connect($cfg->{SoundSoftwareDSN},
-			$cfg->{SoundSoftwareDbUser},
-			$cfg->{SoundSoftwareDbPass});
+	                $cfg->{SoundSoftwareDbUser},
+		        $cfg->{SoundSoftwareDbPass});
 }
 
 1;