bugfix: transfer did not terminate correctly when last packet was full

This commit is contained in:
Fredrik Osterlind 2012-05-29 13:46:22 +02:00
parent f916f2fe24
commit f8e0da428a
2 changed files with 12 additions and 1 deletions

View File

@ -71,11 +71,20 @@ static void
acked(struct runicast_conn *ruc, const rimeaddr_t *to, uint8_t retransmissions)
{
struct rucb_conn *c = (struct rucb_conn *)ruc;
int len;
PRINTF("%d.%d: rucb acked\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
c->chunk++;
if(read_data(c) > 0) {
len = read_data(c);
if(len == 0 && c->last_size == 0) {
/* Nothing more to do */
return;
}
if(len >= 0) {
runicast_send(&c->c, &c->receiver, MAX_TRANSMISSIONS);
c->last_size = len;
/* {
extern struct timetable cc2420_timetable;
timetable_print(&cc2420_timetable);
@ -146,6 +155,7 @@ rucb_open(struct rucb_conn *c, uint16_t channel,
runicast_open(&c->c, channel, &ruc);
c->u = u;
c->last_seqno = -1;
c->last_size = -1;
}
/*---------------------------------------------------------------------------*/
void

View File

@ -67,6 +67,7 @@ struct rucb_conn {
rimeaddr_t receiver, sender;
uint16_t chunk;
uint8_t last_seqno;
int last_size;
};
void rucb_open(struct rucb_conn *c, uint16_t channel,