sd-dhcp6-client: merge client_start() and client_reset()
This commit is contained in:
@@ -584,17 +584,15 @@ static void client_notify(sd_dhcp6_client *client, int event) {
|
||||
client->callback(client, event, client->userdata);
|
||||
}
|
||||
|
||||
static void client_reset(sd_dhcp6_client *client) {
|
||||
static void client_stop(sd_dhcp6_client *client, int error) {
|
||||
DHCP6_CLIENT_DONT_DESTROY(client);
|
||||
|
||||
assert(client);
|
||||
|
||||
client_notify(client, error);
|
||||
|
||||
client->lease = sd_dhcp6_lease_unref(client->lease);
|
||||
|
||||
client->transaction_id = 0;
|
||||
client->transaction_start = 0;
|
||||
|
||||
client->retransmit_time = 0;
|
||||
client->retransmit_count = 0;
|
||||
|
||||
(void) event_source_disable(client->receive_message);
|
||||
(void) event_source_disable(client->timeout_resend);
|
||||
(void) event_source_disable(client->timeout_expire);
|
||||
@@ -604,16 +602,6 @@ static void client_reset(sd_dhcp6_client *client) {
|
||||
client->state = DHCP6_STATE_STOPPED;
|
||||
}
|
||||
|
||||
static void client_stop(sd_dhcp6_client *client, int error) {
|
||||
DHCP6_CLIENT_DONT_DESTROY(client);
|
||||
|
||||
assert(client);
|
||||
|
||||
client_notify(client, error);
|
||||
|
||||
client_reset(client);
|
||||
}
|
||||
|
||||
static int client_append_common_options_in_managed_mode(
|
||||
sd_dhcp6_client *client,
|
||||
uint8_t **opt,
|
||||
@@ -1388,7 +1376,9 @@ int sd_dhcp6_client_start(sd_dhcp6_client *client) {
|
||||
if (!client->information_request && client->request_ia == 0)
|
||||
return -EINVAL;
|
||||
|
||||
client_reset(client);
|
||||
/* Even if the client is in the STOPPED state, the lease acquired in the previous information
|
||||
* request may be stored. */
|
||||
client->lease = sd_dhcp6_lease_unref(client->lease);
|
||||
|
||||
r = client_ensure_iaid(client);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user