Revert "Unlock file while waiting for the DB"
authorAlan T. DeKok <aland@freeradius.org>
Wed, 1 Apr 2015 12:30:04 +0000 (08:30 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 1 Apr 2015 12:30:04 +0000 (08:30 -0400)
This reverts commit a91017d3c391093493757cd4651a455770c4c8c1.

it's better for the server to do this in exfile.c

scripts/sql/radsqlrelay

index 48892e4..3a1efa9 100755 (executable)
@@ -69,18 +69,6 @@ sub setlock($;$$)
     else { return 0 }
 }
 
-sub unlock($;$$)
-{
-    my ($fh, $start, $len) = @_;
-    $start = 0 unless defined $start;
-    $len = 0 unless defined $len;
-
-                                    #type     whence    start   till  pid
-    my $packed = pack($FLOCK_STRUCT, F_WRLCK, SEEK_SET, $start, $len, 0);
-    if (fcntl($fh, F_UNLCK, $packed)) { return 1 }
-    else { return 0 }
-}
-
 sub usage()
 {
     print STDERR <<HERE;
@@ -139,9 +127,7 @@ sub process_file($$)
             } else {
                print "error: Lost connection to database\n";
                $dbinfo->{handle}->disconnect;
-               unlock(\*FILE);
                connect_wait($dbinfo);
-               setlock(\*FILE);
             }
         }
     }