summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-08-18 14:46:14 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-08-19 11:44:33 -0700
commit4999f80c1f56774b5511cf16b38600d016ed892b (patch)
tree1127fde04944bf62acb220e2cd5ce7d17cc63644 /tools
parent60663d4af3ffb6f82e75a3a4bc73b8b8887a3353 (diff)
downloadbluez-4999f80c1f56774b5511cf16b38600d016ed892b.tar.gz
iso-tester: Fix using shutdown(SHUT_RDWR)
shutdown(SHUT_RDWR) results in socket being HUP immeditaly instead of waiting for Disconnect Complete event so instead just use SHUT_WR to start the disconnect procedure without causing the socket to HUP.
Diffstat (limited to 'tools')
-rw-r--r--tools/iso-tester.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index e4950ead7..5727f3055 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -1185,18 +1185,18 @@ static gboolean iso_disconnected(GIOChannel *io, GIOCondition cond,
static void iso_shutdown(struct test_data *data, GIOChannel *io)
{
- int sk, cl;
+ int sk;
sk = g_io_channel_unix_get_fd(io);
- cl = dup(sk);
data->io_id[0] = g_io_add_watch(io, G_IO_HUP, iso_disconnected, data);
- /* Shutdown clone fd so the original fd don't HUP immediately and
- * properly wait for socket to be closed.
+ /* Shutdown using SHUT_WR as SHUT_RDWR cause the socket to HUP
+ * immediately instead of waiting for Disconnect Complete event.
*/
- shutdown(cl, SHUT_RDWR);
- close(cl);
+ shutdown(sk, SHUT_WR);
+
+ tester_print("Disconnecting...");
}
static gboolean iso_connect(GIOChannel *io, GIOCondition cond,