From 9e5063aeebeddfcd31164ec0b952c7f48b9361bb Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 21 Jun 2017 21:13:19 +0200 Subject: ratp: prefer using ratp_send_ack() in behaviour I1 Instead of manually constructing an ACK, use the ratp_send_ack() method, which already does that properly. Signed-off-by: Aleksander Morgado Signed-off-by: Sascha Hauer --- lib/ratp.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index 46a2b645c9..c7f3f41713 100644 --- a/lib/ratp.c +++ b/lib/ratp.c @@ -1330,7 +1330,6 @@ static int msg_recv(struct ratp_internal *ri, void *pkt) static int ratp_behaviour_i1(struct ratp_internal *ri, void *pkt) { struct ratp_header *hdr = pkt; - uint8_t control = 0; if (!ratp_has_data (hdr)) return 1; @@ -1341,15 +1340,10 @@ static int ratp_behaviour_i1(struct ratp_internal *ri, void *pkt) msg_recv(ri, pkt); - if (list_empty(&ri->sendmsg) || ri->sendmsg_current) { - control = ratp_set_sn(!ri->sn_sent) | - ratp_set_an(ri->sn_received + 1) | - RATP_CONTROL_ACK; - - ratp_send_hdr(ri, control); - } else { + if (list_empty(&ri->sendmsg) || ri->sendmsg_current) + ratp_send_ack(ri, hdr); + else ratp_send_next_data(ri); - } return 0; } -- cgit v1.2.3