Use MSG_DONTWAIT flag 08/266408/3
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 11 Nov 2021 15:41:23 +0000 (00:41 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 11 Nov 2021 22:48:38 +0000 (07:48 +0900)
commite1bdc5eb737ba2563575c95d233a3f16f729ef33
treec181fdcefd84d529a4061c15690362480d7c6cd9
parenta6f1292c38b53116f17c8bd3ee14999693620972
Use MSG_DONTWAIT flag

This patch uses MSG_DONTWAIT flag instead of socket existence check.
If calling the send() function returns an error with the errno value
that is EAGAIN or EWOULDBLOCK, the method will call the sleep() and try
to send the data again.
The interval is 2ms. The maximum retry count is 10.
If the retry count exceeds 10 times, AMD will close the file descriptor
to disconnect the connection. When handling the disconnected event,
AMD doesn't invoke the disconnected event callback function if the
client socket is closed. It means the connection is closed by AMD forcedly.

Change-Id: I8217d889506d82418c271d79491817634b33e32d
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_app_request_broker.cc
src/lib/amd_launch.c
src/lib/socket/client_socket.cc