]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
Reenable garbage collection and set a timeout of one second!
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 23 Mar 2021 12:58:08 +0000 (12:58 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 23 Mar 2021 12:58:08 +0000 (12:58 +0000)
nqptp.c

diff --git a/nqptp.c b/nqptp.c
index 4494fc0e8ac0567d2d2fef0236e1b1e890c06bdb..88a36b521875c3516eb39bf82261f51c61e8a8b8 100644 (file)
--- a/nqptp.c
+++ b/nqptp.c
@@ -236,7 +236,7 @@ void deleteObseleteClockRecords(struct ptpSource **list, uint64_t time_now) {
     debug(2, "checking record for Clock ID %" PRIx64 " at %s. Time difference is %" PRId64 ".",
           p->clock_id, p->ip, time_since_last_use);
 
-    if (time_since_last_use > 3600000000000) { // drop them if idle for an hour
+    if (time_since_last_use > 5000000000) {    // drop them if idle
       debug(2, "delete record for Clock ID %" PRIx64 " at %s.", p->clock_id, p->ip);
       if (p->shared_clock_number != -1) {
         int rc = pthread_mutex_lock(&shared_memory->shm_mutex);
@@ -635,7 +635,7 @@ int main(void) {
         FD_SET(sockets[s].number, &readSockSet);
       }
 
-      timeout.tv_sec = 10;
+      timeout.tv_sec = 1;
       timeout.tv_usec = 0;
       int retval = select(smax + 1, &readSockSet, NULL, NULL, &timeout);
       uint64_t reception_time = get_time_now(); // use this if other methods fail
@@ -1277,7 +1277,7 @@ int main(void) {
       }
       // here, invalidate records and entries that are out of date
       uint64_t tn = get_time_now();
-      // deleteObseleteClockRecords(&clocks, tn);
+      deleteObseleteClockRecords(&clocks, tn);
     }
   }