go-coap icon indicating copy to clipboard operation
go-coap copied to clipboard

Fix for messages coming from the message pool always ends up as non-confirmable

Open andersroos opened this issue 2 years ago • 2 comments

Hello!

While using this lib I discovered that observe requests sometimes wasn't retried properly (here). After a bit of digging I found out that messages coming from the message pool always are set to non-confirmable while new messages not coming from the pool are confirmable by default.

Since the blockwise code copies messages it can end up sending a non-confirmable message when the original message was actually set as confirmable.

I am not very familiar with this code base so I am not sure this fix is good, I have tested it with our server and it seems to solve the issue.

To me it feels wrong to assume what the type should be, so I guess it needs to be set every time a message is acquired? Regardless if it is reused or new? I haven't checked the reset of the code base to see if there are more places like this, just this file. In the meantime I use a message pool with 0 max size as a workaround since most messages should be conformable anyway, but that could cause other issues I suppose, I mean I assume that reset sets a message to non-confirmable for a reason.

Cheers and thanks for a good library!

andersroos avatar Jul 22 '22 11:07 andersroos

(Seems OK to me, but I'll wait for Jozef to go over it. He's enjoying his holiday this week, so that'll have to wait for next week.)

Danielius1922 avatar Jul 25 '22 08:07 Danielius1922

Thanks @jkralik! Is on a vacation trip at the moment, will take this up again when I am back home.

andersroos avatar Aug 01 '22 09:08 andersroos

@andersroos Pls could you resolve linter issue - https://github.com/plgd-dev/go-coap/actions/runs/3014872294 ? After that I will merge PR.

jkralik avatar Sep 08 '22 12:09 jkralik

@andersroos Pls could you resolve linter issue - https://github.com/plgd-dev/go-coap/actions/runs/3014872294 ? After that I will merge PR.

Sure! Done.

andersroos avatar Sep 08 '22 13:09 andersroos

Great. Thx for contributing !

jkralik avatar Sep 08 '22 13:09 jkralik