sd-dhcp-client: Add reference counting for DHCP

The DHCP library user can decide to free the DHCP client any time
the callback is called. After the callback has been called, other
computations may still be needed - the best example being a full
restart of the DHCP procedure in case of lease expiry.

Fix this by introducing proper reference counting. Properly handle
a returned NULL from the notify and stop functions if the DHCP
client was freed.
This commit is contained in:
Patrik Flykt
2014-04-11 10:53:10 +03:00
parent 48a4612e6b
commit e5b04c8de8
4 changed files with 73 additions and 33 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ void link_free(Link *link) {
assert(link->manager);
sd_dhcp_client_free(link->dhcp_client);
sd_dhcp_client_unref(link->dhcp_client);
sd_dhcp_lease_unref(link->dhcp_lease);
sd_ipv4ll_free(link->ipv4ll);