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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Nov 2019 21:10:12 +0000 (16:10 -0500)
commitda1e658ad5925713b6880fb87ccfb64e99d3a78f
tree8c77ac0bccaab192b36167f6d8251dba4dc2ff5d
parentd6e1f86bf3bb5d934abfe3e53eb9cbc03cd747d5
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.025642 seconds and 4 git commands to generate.