[ndnSIM] m_delegation is empty while added delegation

Muhammad Hosain Abdollahi Sabet mhasabet at gmail.com
Sun Oct 23 08:33:55 PDT 2016


Hi Junxiao,

Well, I guess I'm having an enlightenment. Is a link object decoded first,
then processed e.g. add/removeDelegation, signed and stuff?

Thanks,
Sabet

On 23 Oct 2016 6:54 pm, "Junxiao Shi" <shijunxiao at email.arizona.edu> wrote:

> Hi Sabet
>
> #3803-6 <https://redmine.named-data.net/issues/3803#note-6> has decided
> that Link without delegation is invalid. Therefore, it's correct for Link(const
> Block&) constructor to throw an exception.
> However, the snippet quoted below isn't implemented correctly. It attempts
> to access m_delegations before calling wireDecode, but m_delegations is not
> populated until wireDecode is executed. Thus, the exception will always be
> thrown.
> While moving the check after wireDecode call would solve the problem, the
> proper place for this check is at the end of wireDecode, because some
> programs may elect to default-construct a Link instance, and invoke
> wireDecode with a block to decode ( Link link; link.wireDecode(block); ),
> and an exception should be thrown in that situation as well.
>
> Yours, Junxiao
>
> On Thu, Oct 20, 2016 at 10:40 AM, Muhammad Hosain Abdollahi Sabet <
> mhasabet at gmail.com> wrote:
>>
>> Link::Link(const Block& block)
>>> {
>>>   if(m_delegations.empty()){
>>>       BOOST_THROW_EXCEPTION(Error("Link object has no
>>> delegationName!"));
>>>   }
>>>   wireDecode(block);
>>> }
>>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20161023/3cda3ea4/attachment.html>


More information about the ndnSIM mailing list