net: zperf: Fix session leak

In case zperf session was aborted by the user (by for instance stopping
it from shell), or practically in case of any other
communication-related error, the zperf session could end up in a state
other than NULL or COMPLETED, with no way to recover. This made the
session no longer usable and eventually could lead to zperf being not
able to start a new session anymore.

Fix this by introducing zperf_session_reset() function, which resets the
session state back to defaults. The function is called when the zperf
receiver service is stopped.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2024-01-31 16:17:45 +01:00 committed by David Leach
commit 68bc981c52
4 changed files with 25 additions and 6 deletions

View file

@ -240,6 +240,8 @@ static void udp_receiver_cleanup(void)
udp_server_running = false;
udp_session_cb = NULL;
zperf_session_reset(SESSION_UDP);
}
static int udp_recv_data(struct net_socket_service_event *pev)