]> jfr.im git - irc/quakenet/newserv.git/blobdiff - proxyscan/proxyscancache.c
TRUSTS: require sqlite
[irc/quakenet/newserv.git] / proxyscan / proxyscancache.c
index 93f0c637d2878e0e9f4b24c3d51e742eb62942d7..8f4b11b8fa4dd06b7bca4e3898e864dc23d56a16 100644 (file)
@@ -24,6 +24,7 @@ cachehost *addcleanhost(time_t timestamp) {
   chp->lastscan=timestamp;
   chp->proxies=NULL;
   chp->glineid=0;
+  chp->lastgline=0;  
   
   return chp;
 }
@@ -92,7 +93,7 @@ void dumpcachehosts(void *arg) {
           } else
         
           for (fpp=chp->proxies;fpp;fpp=fpp->next) 
-            fprintf(fp, "%s %lu %u %i %u\n",IPtostr(node->prefix->sin),chp->lastscan,chp->glineid,fpp->type,fpp->port);
+            fprintf(fp, "%s %lu %u %i %u %lu\n",IPtostr(node->prefix->sin),chp->lastscan,chp->glineid,fpp->type,fpp->port,chp->lastgline);
         } else {
           if (chp->lastscan < (now-cleanscaninterval)) {
             /* Needs rescan anyway, so delete it */
@@ -118,7 +119,7 @@ void dumpcachehosts(void *arg) {
 
 void loadcachehosts() {
   FILE *fp;
-  unsigned long timestamp,glineid,ptype,pport;
+  unsigned long timestamp,glineid,ptype,pport,lastgline;
   char buf[512];
   cachehost *chp=NULL;
   foundproxy *fpp;
@@ -141,7 +142,7 @@ void loadcachehosts() {
       break;
     }
 
-    res=sscanf(buf,"%s %lu %lu %lu %lu",ip,&timestamp,&glineid,&ptype,&pport);
+    res=sscanf(buf,"%s %lu %lu %lu %lu %lu",ip,&timestamp,&glineid,&ptype,&pport,&lastgline);
 
     if (res<2)
       continue;
@@ -155,8 +156,9 @@ void loadcachehosts() {
         chp=addcleanhost(timestamp);
         node->exts[ps_cache_ext] = chp;
       
-        if (res==5) {
+        if (res==6) {
           chp->glineid=glineid;
+          chp->lastgline=lastgline;
           fpp=getfoundproxy();
           fpp->type=ptype;
           fpp->port=pport;
@@ -166,6 +168,8 @@ void loadcachehosts() {
       }
     }
   }
+
+  fclose(fp);
  
   Error("proxyscan",ERR_INFO, "Loaded %d entries from cache", i); 
 }
@@ -236,9 +240,6 @@ void scanall(int type, int port) {
 
       np->host->marker=hostmarker;
 
-      if (!irc_in_addr_is_ipv4(&np->p_ipaddr))
-        continue;
-
       if ((chp=findcachehost(np->ipnode)))
        chp->marker=1;