1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-26 06:58:07 +02:00

fw/dispatch.c: fix initial sequence number; some cleanup

This commit is contained in:
Werner Almesberger 2012-06-20 16:50:55 -03:00
parent 1d1c83f926
commit 1668e702e5

View File

@ -83,11 +83,12 @@ bool dispatch(const uint8_t *buf, uint8_t len, const struct handler **protos)
return 0; return 0;
curr_proto = *protos; curr_proto = *protos;
type = buf[0]; type = buf[0];
seq = 0; seq = 1;
limit = buf[2]; limit = buf[2];
send_ack(buf); send_ack(buf);
return 1; return 1;
} else { }
if (!curr_proto) if (!curr_proto)
return 0; return 0;
if (buf[0] != type) if (buf[0] != type)
@ -103,9 +104,8 @@ bool dispatch(const uint8_t *buf, uint8_t len, const struct handler **protos)
} }
if (buf[1] != seq) if (buf[1] != seq)
return 0; return 0;
}
if (!curr_proto->more(buf[1], limit, buf+3)) if (!curr_proto->more(seq, limit, buf+3))
return 0; return 0;
seq++; seq++;
send_ack(buf); send_ack(buf);