monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] making I(), E(), N() throw bad_decode for network d


From: Thomas Keller
Subject: Re: [Monotone-devel] making I(), E(), N() throw bad_decode for network data
Date: Mon, 10 Nov 2008 13:15:42 +0100
User-agent: Thunderbird 2.0.0.17 (X11/20080922)

Stephen Leake schrieb:
> Timothy Brownawell <address@hidden> writes:
> 
>> I've just pushed a revision that makes the sanity macros look at a
>> 'made_from' value, and throw bad_decode instead of their normal behavior
>> if that value is set to made_from_network. ATOMIC and ENCODING types and
>> revision_t have a member like this, and
>>      revision_t rev;
>>      rev.made_from = made_from_network;
>>      read_revision(garbage_data, rev);
>> does actually throw bad_decode now for at least some kinds of garbage.
> 
> I gather the network sync code handles bad_decode gracefully.
> 
>> I don't particularly like having the macros take a "hidden" argument
>> like this <snip>
> 
> We could define a new set of macros to use in the network sync code.
> 
> But I guess that doesn't help if the network code calls a function
> from another file that uses the standard macros.

I haven't looked at the code, but couldn't we use exceptions for things
like this? I.e. if a malformed packet is given to read_revision, it
throws an MalformedRevisionPacketException which is catched and handled
gracefully in the netsync place and otherwise leads to an I() or E()
somewhere else?

Thomas.

(PS: ignore me if it is not that easy and this discussion tends to get a
bikeshed one)

-- 
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]