diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2020-07-15 13:23:23 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2020-07-15 13:42:14 -0700 |
commit | def01de02593afeb37d2d985ac7ee47cfa720cce (patch) | |
tree | fc881840bfe0976bdeae85d0f063a9fd872eb6a1 /src/main.c | |
parent | df7d3fa5002373f7f955219defc7d0bc794a5a6c (diff) | |
download | bluez-def01de02593afeb37d2d985ac7ee47cfa720cce.tar.gz |
device: Add timer for removing temporary devices
This adds a timer for how long to keep temporary devices, it is updated
everytime the device is seen so devices will be removed even during an
active discovery session which means the discovering for a long period
will no longer just grow without removing devices that disappeared.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index bacb44197..ec7a9fbd7 100644 --- a/src/main.c +++ b/src/main.c @@ -67,6 +67,7 @@ #define DEFAULT_PAIRABLE_TIMEOUT 0 /* disabled */ #define DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */ +#define DEFAULT_TEMPORARY_TIMEOUT 30 /* 30 seconds */ #define SHUTDOWN_GRACE_SECONDS 10 @@ -89,6 +90,7 @@ static const char *supported_options[] = { "FastConnectable", "Privacy", "JustWorksRepairing", + "TemporaryTimeout", NULL }; @@ -531,6 +533,16 @@ static void parse_config(GKeyFile *config) g_free(str); } + val = g_key_file_get_integer(config, "General", + "TemporaryTimeout", &err); + if (err) { + DBG("%s", err->message); + g_clear_error(&err); + } else { + DBG("tmpto=%d", val); + main_opts.tmpto = val; + } + str = g_key_file_get_string(config, "General", "Name", &err); if (err) { DBG("%s", err->message); @@ -672,6 +684,7 @@ static void init_defaults(void) main_opts.class = 0x000000; main_opts.pairto = DEFAULT_PAIRABLE_TIMEOUT; main_opts.discovto = DEFAULT_DISCOVERABLE_TIMEOUT; + main_opts.tmpto = DEFAULT_TEMPORARY_TIMEOUT; main_opts.reverse_discovery = TRUE; main_opts.name_resolv = TRUE; main_opts.debug_keys = FALSE; |