first shmem split
[brisk.git] / web / Obj / hardban.phh
index 61ddb91..99b7033 100644 (file)
@@ -2,7 +2,7 @@
 /*
  *  brisk - auth.phh
  *
- *  Copyright (C) 2006-2008 Matteo Nastasi
+ *  Copyright (C) 2006-2011 Matteo Nastasi
  *                          mailto: nastasi@alternativeoutput.it 
  *                                  matteo.nastasi@milug.org
  *                          web: http://www.alternativeoutput.it
@@ -143,7 +143,7 @@ class Hardbans {
   }
 
   // Static functions
-  function &init_data()
+  static function &create()
   {
     $chal =& new Hardbans();
     
@@ -178,7 +178,7 @@ class Hardbans {
        if ($hban == FALSE) {
          log_only("INIT HARDBAN DATA");
          
-         $hban =& Hardbans::init_data();
+         $hban =& Hardbans::create();
          if (@shm_put_var($shm, $tok, $hban) == FALSE) {
            log_only("PUT_VAR FALLITA ".strlen(serialize($hban)));
            log_only(serialize($hban));
@@ -241,13 +241,11 @@ class Hardbans {
   function lock_data()
   {
     if (($tok = @ftok(FTOK_PATH."/hardbans", "B")) == -1) {
-      echo "FTOK FAILED";
-      exit;
+      return (FALSE);
     }
     // echo "FTOK ".$tok."<br>";
     if (($res = sem_get($tok)) == FALSE) {
-      echo "SEM_GET FAILED";
-      exit;
+      return (FALSE);
     }
     if (sem_acquire($res)) {   
       log_lock("LOCK hardbans");