If the intr channel was disconnected by the other party, then they
are also responsible to close the ctrl channel. Such disconnection
message would have the G_IO_ERR flag set, as opposed to it being
unset if the disconnection is initiated by us.
There doesn't seem to be an explicit rule in the specification
about this behavior, but this is enforced in the PTS qualification
tool.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
idev->intr_io = NULL;
}
- /* Close control channel */
- if (idev->ctrl_io && !(cond & G_IO_NVAL))
+ /* Close control channel if the closing of interrupt channel is not
+ * initiated by the other party
+ */
+ if (idev->ctrl_io && !(cond & (G_IO_NVAL | G_IO_ERR)))
g_io_channel_shutdown(idev->ctrl_io, TRUE, NULL);
btd_service_disconnecting_complete(idev->service, 0);