[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15127 - gauger/web
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15127 - gauger/web |
Date: |
Fri, 29 Apr 2011 19:04:01 +0200 |
Author: bartpolot
Date: 2011-04-29 19:04:00 +0200 (Fri, 29 Apr 2011)
New Revision: 15127
Modified:
gauger/web/io.php
Log:
Added range handling on POST requests
Modified: gauger/web/io.php
===================================================================
--- gauger/web/io.php 2011-04-29 16:33:50 UTC (rev 15126)
+++ gauger/web/io.php 2011-04-29 17:04:00 UTC (rev 15127)
@@ -65,12 +65,32 @@
function get_range_global() {
global $DATADIR;
$f = fopen($DATADIR.'global_range.dat', 'r');
+ flock($f, LOCK_SH);
$buffer = fgets($f, 512);
+ flock($f, LOCK_UN);
fclose($f);
return explode(' ', $buffer);
}
/**
+ * add_range_global: set global range of data considering the new revision
+ * @param data new revision
+ */
+function add_range_global($data) {
+ global $DATADIR;
+ $f = fopen($DATADIR.'global_range.dat', 'r+');
+ flock($f, LOCK_EX);
+ $range = explode(' ', fgets($f, 512));
+ $range[0] = min($range[0], $data);
+ $range[1] = max($range[1], $data);
+ fseek($f, 0, SEEK_SET);
+ fwrite($f, implode(' ', $data));
+ ftruncate($f, ftell($f));
+ flock($f, LOCK_UN);
+ fclose($f);
+}
+
+/**
* get_range: get range of a metric in a host
* @param $host name of the host
* @param $counter file name of the metric
@@ -340,5 +360,6 @@
header('HTTP/1.1 500 Internal Server Error');
die("cannot add data to $datadir.dat");
}
+ add_range_global($rev);
die("OK");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15127 - gauger/web,
gnunet <=