resolver: Fixed cleanup of Resolver timer
authorElena Tebesoi <elena.tebesoi@gmail.com>
Mon, 21 May 2012 15:48:20 +0000 (17:48 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 22 May 2012 19:10:59 +0000 (21:10 +0200)
When connman is restarted, DNS servers are removed and added again
with function __connman_resolver_redo_servers(). While removing a
DNS entry, one should also remove the resolver timer registered for it.
Not doing so, causes the timeout handler resolver_expire_cb to fire
without being explicitly set.

src/resolver.c

index 58af2f7..421b12f 100644 (file)
@@ -493,6 +493,13 @@ int __connman_resolver_redo_servers(const char *interface)
                 */
                __connman_dnsproxy_remove(entry->interface, entry->domain,
                                        entry->server);
+               /*
+                * Remove also the resolver timer for the old server entry.
+                * A new timer will be set for the new server entry
+                * when the next Router Advertisement message arrives
+                * with RDNSS/DNSSL settings.
+                */
+               g_source_remove(entry->timeout);
 
                __connman_dnsproxy_append(entry->interface, entry->domain,
                                        entry->server);