-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: urcd
action: commit
revision:
path_from:
revision_from: d7784cf1fee93d2ed518c24cc57400520b1c5e12:
path_to:
revision_to:

git.thebackupbox.net

urcd

git://git.thebackupbox.net/urcd

commit d7784cf1fee93d2ed518c24cc57400520b1c5e12
Author: root <root@d3v11.ano>
Date:   Tue Apr 16 02:21:28 2013 +0000

    [urccache.c] timecached indexes

diff --git a/src/urccache.c b/src/urccache.c

index ff521228d8583a46295df41660dfb82fc3519d3a..

index ..da7c0489c46e9b3c112d396c8e52df0375d2e6b6 100644

--- a/src/urccache.c
+++ b/src/urccache.c
@@ -29,14 +29,16 @@ main(int argc, char **argv)
   struct passwd *urcd = getpwnam("urcd");
   if ((!urcd) || ((chroot(argv[1])) || (setgid(urcd->pw_gid)) || (setuid(urcd->pw_uid)))) exit(64);

-  unsigned long timecached = time((long *) 0);
   unsigned char cache[256][16384]={0};
   unsigned char buffer[16+8+65536+32];
   unsigned char hash[32];
   unsigned char ts[16];
+  int i, n, l;
+
   float cached[256];
   bzero(cached,sizeof(cached));
-  int i, n, l;
+  unsigned long timecached[256];
+  for (i=0;i<256;++i) timecached[i] = time((long *) 0);

   while (1)
   {
@@ -97,9 +99,9 @@ main(int argc, char **argv)
     if (write(1,"\0",1)<1) exit(6);

     if (cached[hash[0]] == 512.0) cached[hash[0]] = 0.0;
-    if (time((long *) 0) - timecached >= 256)
+    if (time((long *) 0) - timecached[hash[0]] >= 256)
     {
-      timecached = time((long *) 0);
+      timecached[hash[0]] = time((long *) 0);
       bzero(cached,sizeof(cached));
     } ++cached[hash[0]];

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 16:55:56 2024