TSCH: handle error cases returning -1 properly

- tsch_send_eb_process() in tsch-slot-operation.c
- tsch_rx_slot()         in tsch.c
This commit is contained in:
Yasuyuki Tanaka 2016-12-14 16:50:28 +01:00
parent 0b81c0de18
commit 35a1701236
2 changed files with 15 additions and 13 deletions

View file

@ -861,6 +861,7 @@ PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t))
ack_len = tsch_packet_create_eack(ack_buf, sizeof(ack_buf),
&source_address, frame.seq, (int16_t)RTIMERTICKS_TO_US(estimated_drift), do_nack);
if(ack_len > 0) {
#if LLSEC802154_ENABLED
if(tsch_is_pan_secured) {
/* Secure ACK frame. There is only header and header IEs, therefore data len == 0. */
@ -878,6 +879,7 @@ PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t))
NETSTACK_RADIO.transmit(ack_len);
tsch_radio_off(TSCH_RADIO_CMD_OFF_WITHIN_TIMESLOT);
}
}
/* If the sender is a time source, proceed to clock drift compensation */
n = tsch_queue_get_nbr(&source_address);

View file

@ -749,7 +749,7 @@ PROCESS_THREAD(tsch_send_eb_process, ev, data)
#endif /* LLSEC802154_ENABLED */
eb_len = tsch_packet_create_eb(packetbuf_dataptr(), PACKETBUF_SIZE,
&hdr_len, &tsch_sync_ie_offset);
if(eb_len != 0) {
if(eb_len > 0) {
struct tsch_packet *p;
packetbuf_set_datalen(eb_len);
/* Enqueue EB packet */