There currently is a bug in iotivity, where when sending a "cancelobserve" 
request via the iotivity cloud, the client disconnects from the cloud. After 
some debugging, I found that the "cancelobserve" request does not have a 
payload. This causes a disconnect due to the following line:

https://github.com/iotivity/iotivity/blob/c7dce6b522604e2c6b99847c88a00f7da275c08d/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c#L596

However, many other messages also do not have payloads. for example, an 
"observe" request, which only differs from the "cancelobserve" request by 
sending "SUBSCRIBE" instead of "UNSUBSCRIBE". However, and "observe" request 
does not cause a disconnect. This seems to be due to a bug in the calculation 
of the size of the payload, which wrongly returns a very large number instead 
of zero. The bug is in this line:

https://github.com/iotivity/iotivity/blob/e84167a1095d892fc25c1904551f254fbc3c948f/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c#L1250

Following the above, I have two questions I would like to hear your input about:
1. Is there a specific reason for an empty payload in a message to cause a 
disconnect? Can this check be removed?

2. Do you agree that there is a bug in the code that calculates the size of the 
payload?

Reply via email to