summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-06-21 21:13:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-06-23 13:34:07 +0200
commit6b3a3e56faa63397b3c160e74767c620ebca91a7 (patch)
tree3c0084b4d8b4cda3fba403c2e8d76d77bae8e3c5
parent9e5063aeebeddfcd31164ec0b952c7f48b9361bb (diff)
downloadbarebox-6b3a3e56faa63397b3c160e74767c620ebca91a7.tar.gz
barebox-6b3a3e56faa63397b3c160e74767c620ebca91a7.tar.xz
ratp: send initial data in behaviour B if any pending
And also, use ratp_send_ack() instead of manually constructing an ACK if no data is pending to be sent. The current barebox implementation doesn't allow any queueing of data until the connection is established, so this is probably not a case that would get run anyway. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--lib/ratp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ratp.c b/lib/ratp.c
index c7f3f4171..e810a9e54 100644
--- a/lib/ratp.c
+++ b/lib/ratp.c
@@ -622,11 +622,11 @@ static void ratp_behaviour_b(struct ratp_internal *ri, void *pkt)
ri->sn_received = ratp_sn(hdr);
if (hdr->control & RATP_CONTROL_ACK) {
- control = ratp_set_sn(ratp_an(hdr)) |
- ratp_set_an(!ratp_sn(hdr)) |
- RATP_CONTROL_ACK;
- ratp_send_hdr(ri, control);
ratp_state_change(ri, RATP_STATE_ESTABLISHED);
+ if (list_empty(&ri->sendmsg) || ri->sendmsg_current)
+ ratp_send_ack(ri, hdr);
+ else
+ ratp_send_next_data(ri);
} else {
struct ratp_header synack = {};