libsystemd-network: do not request each daemon exist in sd_xxx_stop()

This commit is contained in:
Yu Watanabe 2020-10-15 07:24:17 +09:00
parent 1008f5b069
commit c8bae36372
8 changed files with 17 additions and 9 deletions

View file

@ -2135,9 +2135,10 @@ int sd_dhcp_client_send_decline(sd_dhcp_client *client) {
}
int sd_dhcp_client_stop(sd_dhcp_client *client) {
DHCP_CLIENT_DONT_DESTROY(client);
if (!client)
return 0;
assert_return(client, -EINVAL);
DHCP_CLIENT_DONT_DESTROY(client);
client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
client->state = DHCP_STATE_STOPPED;

View file

@ -225,7 +225,8 @@ sd_event *sd_dhcp_server_get_event(sd_dhcp_server *server) {
}
int sd_dhcp_server_stop(sd_dhcp_server *server) {
assert_return(server, -EINVAL);
if (!server)
return 0;
server->receive_message =
sd_event_source_unref(server->receive_message);

View file

@ -1676,7 +1676,8 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state) {
}
int sd_dhcp6_client_stop(sd_dhcp6_client *client) {
assert_return(client, -EINVAL);
if (!client)
return 0;
client_stop(client, SD_DHCP6_CLIENT_EVENT_STOP);

View file

@ -144,7 +144,8 @@ static void ipv4acd_client_notify(sd_ipv4acd *acd, int event) {
int sd_ipv4acd_stop(sd_ipv4acd *acd) {
IPv4ACDState old_state;
assert_return(acd, -EINVAL);
if (!acd)
return 0;
old_state = acd->state;

View file

@ -89,7 +89,8 @@ int sd_ipv4ll_new(sd_ipv4ll **ret) {
}
int sd_ipv4ll_stop(sd_ipv4ll *ll) {
assert_return(ll, -EINVAL);
if (!ll)
return 0;
return sd_ipv4acd_stop(ll->acd);
}

View file

@ -276,7 +276,8 @@ fail:
}
_public_ int sd_lldp_stop(sd_lldp *lldp) {
assert_return(lldp, -EINVAL);
if (!lldp)
return 0;
if (lldp->fd < 0)
return 0;

View file

@ -321,7 +321,8 @@ static int ndisc_timeout_no_ra(sd_event_source *s, uint64_t usec, void *userdata
}
_public_ int sd_ndisc_stop(sd_ndisc *nd) {
assert_return(nd, -EINVAL);
if (!nd)
return 0;
if (nd->fd < 0)
return 0;

View file

@ -353,7 +353,8 @@ fail:
_public_ int sd_radv_stop(sd_radv *ra) {
int r;
assert_return(ra, -EINVAL);
if (!ra)
return 0;
if (ra->state == SD_RADV_STATE_IDLE)
return 0;