src.ctf.lttng-live: don't try to detach after socket error
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 8 Nov 2019 18:34:01 +0000 (13:34 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 15 Nov 2019 17:28:24 +0000 (12:28 -0500)
commitb197ca376583c58194ed2a4a02dc32ba9efecf01
tree0adaa25beb4c149e5beacca989ac9a8b0b2bc938
parent76bbaebcbc68c8765517a3db2c293fad83a5d162
src.ctf.lttng-live: don't try to detach after socket error

Background
==========
The message iterator `_finalize()` method typically needs to detach from
the live session (LTTNG_VIEWER_DETACH_SESSION) so that the relay daemon
can free up the associated resources.

Issue
=====
In the case we encounter a socket error during the `_next()` method,
we don't want a component to try to send a detach command to the relay
during the `_iter_finalize()` method as this will surely lead to another
error. The annoying thing is that this other error would pollute the
error cause stack that lead to the first error.

Solution
========
Close the socket when we encounter an error and check in the
`lttng_live_detach_session` function if the socket it valid before
sending a _DETACH_SESSION command.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ic56e72013e78e4c5ef3343034b0e6f216599be6a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2357
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/plugins/ctf/lttng-live/viewer-connection.c
This page took 0.0251 seconds and 4 git commands to generate.