Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect link objects are implicitly sent on update #8

Closed
ghost opened this issue Mar 23, 2015 · 5 comments
Closed

Incorrect link objects are implicitly sent on update #8

ghost opened this issue Mar 23, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 23, 2015

It seems that on performing an update request from client (with empty (null) object links argument) CoapClientRequestBuilder performs an implicit paylodizing of link objects from the object definition in visit(UpdateRequest):

        if (linkObjects == null)
            payload = LinkFormatUtils.payloadize(clientObjectModel);
        else
            payload = LinkFormatUtils.payloadize(linkObjects);
       coapRequest.setPayload(payload);

Because the object links are not required for update, this conversion should only be performed if link objects are provided with the UpdateRequest, like this:

        if (linkObjects != null) {
            payload = LinkFormatUtils.payloadize(linkObjects);
            coapRequest.setPayload(payload);
        }

BTW the link objects found in definition are also containing only object IDs, like </1>,</3> etc. This seems to be an incorrect behavior in visit(RegisterRequest).

@sbernard31
Copy link
Contributor

You're right, since the refactoring/API changing all about object links (register, update, discover) is in a pretty bad state.
I currently work on it.

@sbernard31
Copy link
Contributor

So, I fixed the problem of link object which does not contains instance ID at registration.
I also integrated what you propose to fix the update problem.
But, This means now when you want to update the Link Object part you must write something like that ...

client.send(new UpdateRequest(
         "registrationId", null, null, null, 
         LinkFormatHelper.getClientDescription(client.getObjectEnablers(), null)));

not really sexy !
Maybe, it's not so bad, because we should probably manage update automatically. User should not have to write this kind of code ...

@ghost
Copy link
Author

ghost commented Mar 27, 2015

Yes, may be we can improve this in the future...

@ingoschaal
Copy link
Contributor

The implementation of the visit method with UpdateRequest still contains this implementation:

LinkObject[] linkObjects = request.getObjectLinks();
if (linkObjects == null) 
coapRequest.setPayload(LinkObject.serialyse(linkObjects));

I think it should be implemented as described above

    if (linkObjects != null) {
        payload = LinkFormatUtils.payloadize(linkObjects);
        coapRequest.setPayload(payload);
    }

sbernard31 added a commit that referenced this issue Apr 16, 2015
@sbernard31
Copy link
Contributor

It was a bug. it should be fixed now.

@ghost ghost closed this as completed Apr 23, 2015
mike-scott pushed a commit to mike-scott/leshan that referenced this issue Jan 31, 2018
…-session

Store PSK Identity in the DTLS Session
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants