• R/O
  • SSH
  • HTTPS

ogup: 提交


Commit MetaInfo

修訂39 (tree)
時間2021-12-07 06:22:41
作者mateuszviste

Log Message

save/load db also takes care of the nextcheck timestamp

Change Summary

差異

--- trunk/gopherjoker/gopherjoker.c (revision 38)
+++ trunk/gopherjoker/gopherjoker.c (revision 39)
@@ -112,7 +112,7 @@
112112 int i;
113113 char *ptrs[4];
114114 char lbuf[256];
115- struct gopherlist *res = NULL;
115+ struct gopherlist *res = NULL, *newnode;
116116 fd = fopen(fname, "rb");
117117 if (fd == NULL) return(NULL);
118118 for (;;) {
@@ -121,13 +121,16 @@
121121 /* TSV line structure
122122 * 0 hostname
123123 * 1 port
124- * 2 failedsince (time_t) */
124+ * 2 failedsince (time_t)
125+ * 3 nextcheck (time_t) */
125126
126- if (glist_addnewhostport(&res, ptrs[0], (unsigned short)atoi(ptrs[1]), atol(ptrs[2])) == NULL) {
127+ newnode = glist_addnewhostport(&res, ptrs[0], (unsigned short)atoi(ptrs[1]), atol(ptrs[2]));
128+ if (newnode == NULL) {
127129 /* on error, free list and quit */
128130 glist_free(res);
129131 return(NULL);
130132 }
133+ newnode->nextcheck = atoi(ptrs[3]);
131134 }
132135 fclose(fd);
133136 return(res);
@@ -145,7 +148,7 @@
145148 if (node->failedsince == 0) countactive++;
146149 if (node->failedsince == 1) countpending++;
147150 if (node->failedsince > 1) countdown++;
148- fprintf(f, "%s,%u,%ld\n", node->fqdn, node->port, node->failedsince);
151+ fprintf(f, "%s,%u,%ld,%ld\n", node->fqdn, node->port, node->failedsince, node->nextcheck);
149152 }
150153 fclose(f);
151154 f = fopen(fcount, "wb");
@@ -515,7 +518,7 @@
515518 continue;
516519 }
517520
518- /* try adding hosts to global glist (and count 'em) */
521+ /* try adding hosts to global glist */
519522 for (gnode = mlist; gnode != NULL; gnode = gnode->next) {
520523 glist_addnewhostport(&glist, gnode->fqdn, gnode->port, 1);
521524 }
Show on old repository browser