do not write empty logs when started
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Fri, 13 Oct 2017 14:46:31 +0000 (14:46 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Fri, 13 Oct 2017 14:46:31 +0000 (14:46 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@261 251d49ef-1d17-4917-a970-b30cf55b089b

htmlandlogs.c
parseiptables.c

index b6f9cb6..bff5cb3 100644 (file)
@@ -22,6 +22,7 @@ extern int found_lmsid;
 extern char *lms_url;\r
 extern char *log_dir;\r
 extern char *ip6prefix;\r
+extern int traffic_detected;\r
 \r
 const char *tr_odd_even(void);\r
 /* implemented in prometheus.c, shared with parselogs.c */\r
@@ -402,7 +403,7 @@ style=\"cursor: pointer;\">+%d</a>]</span>",
     insert(sum,sums,order_by,i);\r
    }\r
 \r
-   if(!just_preview)\r
+   if(!just_preview && traffic_detected)\r
    {\r
     append_log(ip);\r
     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing))\r
index 8544df7..5a2043f 100644 (file)
@@ -13,12 +13,15 @@ extern int free_min;
 extern int free_max;\r
 extern int include_upload;\r
 \r
+int traffic_detected = 0;\r
+\r
 /* ===================== traffic analyser - uses iptables  ================ */ \r
 \r
 void get_traffic_statistics(const char *whichiptables, int ipv6)\r
 {\r
  char *str,*cmd;\r
- int downloadflag=0;\r
+ int downloadflag = 0;\r
+ traffic_detected = 0;\r
 \r
  textfile(Pipe,str) *line,*lines=NULL;\r
  string(str,STRLEN);\r
@@ -78,6 +81,10 @@ void get_traffic_statistics(const char *whichiptables, int ipv6)
            else\r
            {\r
             sscanf(ptr,"%Lu",&traffic); \r
+            if(traffic)\r
+            {\r
+             traffic_detected = 1;\r
+            }\r
             traffic += (1<<19);\r
             traffic >>= 20;\r
            }\r
This page took 0.104566 seconds and 4 git commands to generate.