serialqueue: Don't report sent_time on responses that are retransmitted

On a retransmit, the sent_time of the command associated with the
given response message isn't accurate.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-09-30 15:35:20 -04:00
parent 6f65ba9214
commit 61ee63f358
1 changed files with 2 additions and 1 deletions

View File

@ -517,7 +517,8 @@ handle_message(struct serialqueue *sq, double eventtime, int len)
if (len > MESSAGE_MIN) { if (len > MESSAGE_MIN) {
// Add message to receive queue // Add message to receive queue
struct queue_message *qm = message_fill(sq->input_buf, len); struct queue_message *qm = message_fill(sq->input_buf, len);
qm->sent_time = sq->last_receive_sent_time; qm->sent_time = (rseq > sq->retransmit_seq
? sq->last_receive_sent_time : 0.);
qm->receive_time = get_monotonic(); // must be time post read() qm->receive_time = get_monotonic(); // must be time post read()
qm->receive_time -= sq->baud_adjust * len; qm->receive_time -= sq->baud_adjust * len;
list_add_tail(&qm->node, &sq->receive_queue); list_add_tail(&qm->node, &sq->receive_queue);