Don't append meshms timestamps if the clock is considered unreliable

This commit is contained in:
Jeremy Lakeman 2016-05-31 13:00:48 +09:30
parent d9e89fd299
commit 802310c6f1
2 changed files with 3 additions and 1 deletions

View File

@ -417,12 +417,12 @@ END_STRUCT
STRUCT(rhizome)
ATOM(bool_t, enable, 1, boolean,, "If true, server opens Rhizome database when starting")
ATOM(bool_t, fetch, 1, boolean,, "If false, no new bundles will be fetched from peers")
ATOM(bool_t, reliable_clock, 1, boolean,, "If false, consider the system clock to be unreliable for generating timestamps")
ATOM(bool_t, clean_on_open, 0, boolean,, "If true, Rhizome database is cleaned at start of every command")
STRING(256, datastore_path, "", str_nonempty,, "Path of rhizome storage directory, absolute or relative to instance directory")
ATOM(uint64_t, database_size, UINT64_MAX, uint64_scaled,, "Maximum size of database in bytes")
ATOM(uint64_t, min_free_space, 100*1024*1024, uint64_scaled,, "Minimum free space to preserve on the disk")
ATOM(uint32_t, max_blob_size, 128 * 1024, uint32_scaled,, "Store payloads larger than this in files not SQLite blobs")
ATOM(uint64_t, idle_timeout, RHIZOME_IDLE_TIMEOUT, uint64_scaled,, "Rhizome transfer timeout if no data received.")
ATOM(uint32_t, fetch_delay_ms, 50, uint32_nonzero,, "Delay from receiving first bundle advert to initiating fetch")
SUB_STRUCT(rhizome_direct, direct,)

View File

@ -218,6 +218,8 @@ static size_t append_footer(unsigned char *buffer, char type, size_t message_len
// append a timestamp as a uint32_t with 1s precision
static size_t append_timestamp(uint8_t *buffer)
{
if (!config.rhizome.reliable_clock)
return 0;
write_uint32(buffer, gettime());
size_t ofs=4;
return ofs+append_footer(buffer+ofs, MESHMS_BLOCK_TYPE_TIME, ofs);