Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef4ecee0 authored by Katish Paran's avatar Katish Paran Committed by Gerrit - the friendly Code Review server
Browse files

diag: Do not close the server in case for peripheral restart



Currently, apps diag is closing and re-opening the server channel
in case for peripheral restart. In some cases new address update
may not happen for peripheral and peripheral may still send data
to old address. This patch ensures that the server is never
closed.

Change-Id: I4c1740f968e68afe66904f66afc0e4b1bc4fd66d
Signed-off-by: default avatarKatish Paran <kparan@codeaurora.org>
parent af8bd7c7
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -441,6 +441,9 @@ static void __socket_close_channel(struct diag_socket_info *info)
	diagfwd_channel_close(info->fwd_ctxt);

	atomic_set(&info->opened, 0);

	/* Don't close the server. Server should always remain open */
	if (info->port_type != PORT_TYPE_SERVER) {
		write_lock_bh(&info->hdl->sk->sk_callback_lock);
		info->hdl->sk->sk_user_data = NULL;
		info->hdl->sk->sk_data_ready = NULL;
@@ -448,6 +451,7 @@ static void __socket_close_channel(struct diag_socket_info *info)
		sock_release(info->hdl);
		info->hdl = NULL;
		wake_up(&info->read_wait_q);
	}
	DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s exiting\n", info->name);

	return;
@@ -459,12 +463,7 @@ static void socket_close_channel(struct diag_socket_info *info)
		return;

	__socket_close_channel(info);
	/*
	 * Open the servers again after closing. The servers must always be
	 * active.
	 */
	if (info->port_type == PORT_TYPE_SERVER)
		socket_open_server(info);

	DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s exiting\n", info->name);
}