sics-iot / lwm2m-contiki

LWM2M client for Contiki
Other
7 stars 10 forks source link

Missing to send last block2 package #26

Open danielkilbo opened 6 years ago

danielkilbo commented 6 years ago

When the server uses less size on the coap messages than the device is set up with. The coap double buffer will get filled with more data than able to send with a block2 (opaque).

In case of transfers of large opaques the object callback will finish the coap buffer filling before last request comes in from the server. The rest of the read request(s) from the server the opaque callback will not be called. Which is correct. But the sending will be interrupted just before the end of the opaque due that the lwm2m engine do not know to proceed the sending with the data in the coap buffer.

The problem arises in perform_multi_resource_read_op() function when it return an error instead of sending next part of the opaque.

Could current fix work: if (!(lwm2m_buf.len > 0 && lwm2m_buf_lock[0])) // New check if data still shall be sent { /* did not read anything even if we should have - on single item */ if(num_read == 0 && ctx->level == 3) { lwm2m_buf_lock[0] = 0; ERROR_HANDLER(ERROR_NOT_FOUND, "Nothing read", SEVERITY_LVL_INFO); return LWM2M_STATUS_NOT_FOUND; } }