]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9886 Maintain si_lastcontact as struct timeval
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 26 Sep 2022 09:55:09 +0000 (10:55 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 26 Sep 2022 16:37:14 +0000 (16:37 +0000)
servers/slapd/syncrepl.c

index 3d65b430b6f97c5cfd450a80e198102430d1e254..c28de10f6446f68f0e078e9bcdb3fee4e5a8ef34 100644 (file)
@@ -176,7 +176,7 @@ typedef struct syncinfo_s {
        /* monitor info */
        int             si_monitorInited;
        time_t  si_lastconnect;
-       time_t  si_lastcontact;
+       struct timeval  si_lastcontact;
        struct berval   si_connaddr;
        struct berval   si_lastCookieRcvd;
        struct berval   si_lastCookieSent;
@@ -1361,7 +1361,7 @@ do_syncrep2(
                        rc = SYNC_SHUTDOWN;
                        goto done;
                }
-               si->si_lastcontact = slap_get_time();
+               gettimeofday( &si->si_lastcontact, NULL );
                switch( ldap_msgtype( msg ) ) {
                case LDAP_RES_SEARCH_ENTRY:
 #ifdef LDAP_CONTROL_X_DIRSYNC
@@ -7095,8 +7095,9 @@ syncrepl_monitor_update(
                if ( a->a_desc != ad_olmLastContact )
                        return SLAP_CB_CONTINUE;
 
-               if ( si->si_lastcontact ) {
-                       ldap_pvt_gmtime( &si->si_lastcontact, &tm );
+               if ( si->si_lastcontact.tv_sec ) {
+                       time_t last_contact = si->si_lastcontact.tv_sec;
+                       ldap_pvt_gmtime( &last_contact, &tm );
                        lutil_gentime( tmbuf, sizeof( tmbuf ), &tm );
                        len = strlen( tmbuf );
                        assert( len == a->a_vals[0].bv_len );