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: Timothy Brownawell
Subject: Re: [Monotone-devel] making I(), E(), N() throw bad_decode for network data
Date: Tue, 11 Nov 2008 01:04:19 +0000

On Mon, 2008-11-10 at 07:06 -0500, Stephen Leake wrote:
> 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.

Yes, its purpose is to be caught where it can terminate a particular
connection without killing the entire process.

> > 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.

The netsync code and a few places that are only called from there
actually do throw bad_decode directly instead of using the sanity macros
for data errors.

> But I guess that doesn't help if the network code calls a function
> from another file that uses the standard macros.

Yes, that's what I'm trying to address here. If we have malformed
basic_io, or a "revision" that actually isn't, or a file that doesn't
match the given hash... the code that finds these errors is the same
whether the data was generated internally or from the database, or came
from the network.

-- 
Timothy

Free (experimental) public monotone hosting: http://mtn-host.prjek.net





reply via email to

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