Fix: update next_net_seq_num after sending header
authorDavid Goulet <dgoulet@efficios.com>
Thu, 10 Jan 2013 17:07:35 +0000 (12:07 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 10 Jan 2013 17:43:33 +0000 (12:43 -0500)
commit3604f373dd93990e0fd6342cfe4c657efaa171bb
treea2f7c2efd2c5d0b94af56fe76d0e88f170f5e455
parent3714380f76f56da2dfce53e07aa4f804a350047c
Fix: update next_net_seq_num after sending header

Increment the sequence number after we are sure that the relayd has
received correctly the data header. If an error occurs when sending the
header, the data won't be extracted from the buffers thus keeping this
sequence number untouched.

Furthermore, after sending the header, if the relayd dies, this value
won't matter much and if there is an error on the stream when reading
the trace data, the stream will be deleted thus closed on the relayd
making this value useless.

It's important to note that this sequence number is updated on the
relayd side if the full expected data packet was received. So,
incrementing the value after the transmission of the header is not
changing anything in terms of value coherency. The point is to have a
semantic of when read and used successfully (transmission to relayd),
let's update it.

In that code flow, the stream's lock is acquired so no need to
read/update it atomically. I've also added a comments to better
understand the purpose of this variable and how to use it.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/consumer.c
src/common/consumer.h
This page took 0.025013 seconds and 4 git commands to generate.