Fix: send the streams sent message after metadata

We now make sure that we only sent the streams_sent message to the relay
when all the streams (including the metadata) are sent.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: notify the viewer if new streams got added

As soon as new streams are available, the viewer must start reading
them, otherwise we risk to ignore complete streams.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: handle new streams in live mode in relayd

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: code refactoring of viewer streams in relayd

This also renames the lttng-viewer.h to lttng-viewer-abi.h which
represents the live reading ABI.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
[HEAD MERGE] Start of mofos cleanup

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] Add stream.c/.h

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] add tail and move rcu lock

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] Add session create and fix id assignation

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] fix session init

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] fix session destroy and ctf trace put ref

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] add comments and a session close_flag

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] cleanup ctf_trace if refcount down to 0

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] fix update metadata sent in ctf_trace

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] don't rotate stream if count is zero

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] Fix viewer rotation and get next index

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] Send already attach to a double attach from the same client

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] close stream on del connection

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] fix attach session refcounting

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] fix refcount attach session

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] don't delete session if none assign to the connection

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] fix close stream check out of order

Signed-off-by: David Goulet <dgoulet@efficios.com>

[MERGE] detacth session if already attached

Signed-off-by: David Goulet <dgoulet@efficios.com>

FIX: live quit pipe

Signed-off-by: David Goulet <dgoulet@efficios.com>

FIX: missing decl

Signed-off-by: David Goulet <dgoulet@efficios.com>
[HEAD MERGE] Connection objects refactor

Signed-off-by: David Goulet <dgoulet@efficios.com>

Fix: connection

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: Namespace lttng-viewer-abi

This header is copied to all the viewers that implement the lttng-live
protocol, we need to make sure it is properly namespaced.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Force the client to create a viewer session before attaching

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Fix: handle session hang up in get_new_streams

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Allow attach to multiple sessions

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Move static functions up to access them from get_new_streams

When we detect that the viewer is trying to get new streams for a
session closed and for which it already got all the streams, we can
delete and destroy the session, we know it won't be useful anymore.

FIXME: we should probably when we destroy the last stream of a ctf_trace
(when only the metadata remains).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
check for new streams in all attached sessions

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Fix: use uint32_t for metadata_flag in viewer's ABI

This struct is meant to be sent over the network so members should be
of exact-width.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>