Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[iot-wg] Leshan: Registered links removed on registration update with empty payload

Hi,

I’m not sure if this is the right place, so please redirect me as necessary. 

I’ve been using the Leshan sandbox server to debug some LWM2M client libraries and am hitting what looks like a server problem.

I found what I believe to be an error in handling of LWM2M registration updates. 

Leshan appears to be clearing the registered resource links on registration update. 

It appears that Leshan expects a NULL return value from the Californium library request.getPayload() if the payload is empty. 

If it thinks there is a payload by the value being non-null, it replaces the contents of the links:

        if (request.getPayload() != null) {
            objectLinks = new String(request.getPayload(), Charsets.UTF_8).split(",");
        }

        ClientUpdate client = new ClientUpdate(registrationId, request.getSource(), request.getSourcePort(), lifetime,
                smsNumber, binding, objectLinks);

But Californium signals an empty payload with a zero length array of bytes (wondering in the comments if it should be NULL instead)

if (nextByte == PAYLOAD_MARKER) {
// the presence of a marker followed by a zero-length payload must be processed as a message format error
if (!reader.bytesAvailable())
throw new IllegalStateException();

// get payload
message.setPayload(reader.readBytesLeft());
} else {
message.setPayload(new byte[0]); // or null?
}


Back to the top