You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AddOption expects that the packet is ended with END, but if the initial packet was smaller than 300 bytes, PadToMinSize is called and so the packet is padded and AddOption doesn't remove the END.
Can we postpone PadToMinSize until Serve?
The text was updated successfully, but these errors were encountered:
That would be a breaking change for those who run their own Serve, as one can currently expect that the message packets coming out of New and Reply to be valid messages ready to go.
One solution may be for AddOption to check for padding, and if it's there:
trim padding
defer PadToMinSize()
continue rest of function.
My question is however, is this a real problem? It appears to be only padded if you are calling New or Reply, which both expect you to pass your desired options upfront. AddOption is more about building the packet, not editing it (no DeleteOption for example). Perhaps the real solution is to improve the function comments.
Thank you. We were modifying the packet on some condition. We fixed it by doing the changes on the options and then creating the packet and returning it without touching the result of ReplyPacket.
AddOption
expects that the packet is ended withEND
, but if the initial packet was smaller than 300 bytes,PadToMinSize
is called and so the packet is padded andAddOption
doesn't remove theEND
.Can we postpone
PadToMinSize
untilServe
?The text was updated successfully, but these errors were encountered: