diff options
author | Vladimir Kobal <vlad@prokk.net> | 2022-01-11 13:12:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 13:12:09 +0200 |
commit | 4919103c4b715a83ebcc677431dab6ecbacabc9c (patch) | |
tree | bfbf35b20b5679358ffc09fedfd3a9e5d2504c3b /streaming | |
parent | 237c117da6f250ab37af849e7a430ccad3238097 (diff) |
Fix time_t format (#11897)
Diffstat (limited to 'streaming')
-rw-r--r-- | streaming/receiver.c | 36 | ||||
-rw-r--r-- | streaming/rrdpush.c | 18 | ||||
-rw-r--r-- | streaming/sender.c | 2 |
3 files changed, 43 insertions, 13 deletions
diff --git a/streaming/receiver.c b/streaming/receiver.c index e8f8528a75..483cc68e59 100644 --- a/streaming/receiver.c +++ b/streaming/receiver.c @@ -69,15 +69,33 @@ PARSER_RC streaming_timestamp(char **words, void *user, PLUGINSD_ACTION *plugins time_t now = now_realtime_sec(), prev = rrdhost_last_entry_t(host); time_t gap = 0; if (prev == 0) - info("STREAM %s from %s: Initial connection (no gap to check), remote=%ld local=%ld slew=%ld", - host->hostname, cd->cmd, remote_time, now, now-remote_time); + info( + "STREAM %s from %s: Initial connection (no gap to check), " + "remote=%"PRId64" local=%"PRId64" slew=%"PRId64"", + host->hostname, + cd->cmd, + (int64_t)remote_time, + (int64_t)now, + (int64_t)now - remote_time); else { gap = now - prev; - info("STREAM %s from %s: Checking for gaps... remote=%ld local=%ld..%ld slew=%ld %ld-sec gap", - host->hostname, cd->cmd, remote_time, prev, now, remote_time - now, gap); + info( + "STREAM %s from %s: Checking for gaps... " + "remote=%"PRId64" local=%"PRId64"..%"PRId64" slew=%"PRId64" %"PRId64"-sec gap", + host->hostname, + cd->cmd, + (int64_t)remote_time, + (int64_t)prev, + (int64_t)now, + (int64_t)(remote_time - now), + (int64_t)gap); } char message[128]; - sprintf(message,"REPLICATE %ld %ld\n", remote_time - gap, remote_time); + sprintf( + message, + "REPLICATE %"PRId64" %"PRId64"\n", + (int64_t)(remote_time - gap), + (int64_t)remote_time); int ret; #ifdef ENABLE_HTTPS SSL *conn = host->stream_ssl.conn ; @@ -441,10 +459,10 @@ static int rrdpush_receive(struct receiver_state *rpt) if(health_enabled != CONFIG_BOOLEAN_NO) { if(alarms_delay > 0) { rpt->host->health_delay_up_to = now_realtime_sec() + alarms_delay; - info("Postponing health checks for %ld seconds, on host '%s', because it was just connected." - , alarms_delay - , rpt->host->hostname - ); + info( + "Postponing health checks for %" PRId64 " seconds, on host '%s', because it was just connected.", + (int64_t)alarms_delay, + rpt->host->hostname); } } rrdhost_unlock(rpt->host); diff --git a/streaming/rrdpush.c b/streaming/rrdpush.c index be94742168..14c50a3ea2 100644 --- a/streaming/rrdpush.c +++ b/streaming/rrdpush.c @@ -287,7 +287,7 @@ static inline void rrdpush_send_chart_metrics_nolock(RRDSET *st, struct sender_s RRDHOST *host = st->rrdhost; buffer_sprintf(host->sender->build, "BEGIN \"%s\" %llu", st->id, (st->last_collected_time.tv_sec > st->upstream_resync_time)?st->usec_since_last_update:0); if (s->version >= VERSION_GAP_FILLING) - buffer_sprintf(host->sender->build, " %ld\n", st->last_collected_time.tv_sec); + buffer_sprintf(host->sender->build, " %"PRId64"\n", (int64_t)st->last_collected_time.tv_sec); else buffer_strcat(host->sender->build, "\n"); @@ -681,7 +681,13 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *url) { host->receiver->shutdown = 1; shutdown(host->receiver->fd, SHUT_RDWR); host->receiver = NULL; // Thread holds reference to structure - info("STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - existing connection is dead (%ld sec), accepting new connection.", host->hostname, w->client_ip, w->client_port, age); + info( + "STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - " + "existing connection is dead (%"PRId64" sec), accepting new connection.", + host->hostname, + w->client_ip, + w->client_port, + (int64_t)age); } else { netdata_mutex_unlock(&host->receiver_lock); @@ -689,7 +695,13 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *url) { rrd_unlock(); log_stream_connection(w->client_ip, w->client_port, key, host->machine_guid, host->hostname, "REJECTED - ALREADY CONNECTED"); - info("STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - existing connection is active (within last %ld sec), rejecting new connection.", host->hostname, w->client_ip, w->client_port, age); + info( + "STREAM %s [receive from [%s]:%s]: multiple connections for same host detected - " + "existing connection is active (within last %"PRId64" sec), rejecting new connection.", + host->hostname, + w->client_ip, + w->client_port, + (int64_t)age); // Have not set WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET - caller should clean up buffer_flush(w->response.data); buffer_strcat(w->response.data, "This GUID is already streaming to this server"); diff --git a/streaming/sender.c b/streaming/sender.c index 341f600ca2..7a18713a62 100644 --- a/streaming/sender.c +++ b/streaming/sender.c @@ -646,7 +646,7 @@ void *rrdpush_sender_thread(void *ptr) { if (s->version >= VERSION_GAP_FILLING) { time_t now = now_realtime_sec(); sender_start(s); - buffer_sprintf(s->build, "TIMESTAMP %ld", now); + buffer_sprintf(s->build, "TIMESTAMP %"PRId64"", (int64_t)now); sender_commit(s); } rrdpush_claimed_id(s->host); |