monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] Key identities...


From: Timothy Brownawell
Subject: Re: [Monotone-devel] Key identities...
Date: Mon, 05 Nov 2007 07:07:41 -0600

On Mon, 2007-11-05 at 00:33 -0800, Nathaniel Smith wrote:
> On Sun, Nov 04, 2007 at 07:55:10PM -0600, Timothy Brownawell wrote:
> > Could we also handle this by making process_data_command error() on
> > data_exists for a key item? I believe all keys are sent before any certs
> > are sent, so this should block any key collision errors from propagating
> > over netsync.

...err, except that data_exists checks by hash, not name. d'oh. But that
really only means we do the check a couple lines later.

> It already does error out if you try to put two keys with the same
> name into the same db. 

database::put_key() will W() and return false. So the thing to do would
be something like this:

--- netsync.cc  d577024111ef69679d929cb85b1c1e56c7504cff
+++ netsync.cc  50b0ee5fa1808bdcf31ff87cf3c5716c9d2ad009
@@ -1954,6 +1954,9 @@ session::process_data_cmd(netcmd_item_ty
                            % hitem % keyid % hitem % tmp);
         if (app.db.put_key(keyid, pub))
           written_keys.push_back(keyid);
+        else
+          error(partial_transfer,
+                (F("Received duplicate key %s") % keyid).str());
       }
       break;
 

...actually, I think I'll add a test and commit that.

> Does netsync really send keys first before certs?  I don't remember
> that.  (In general we don't consider it an error to have a cert
> without a key, so it might not be being handled the same way as say
> files-before-revs-before-certs.)

It queues all the keys from process_done_command when key refinement
finishes. Revs and certs are queued from the event loop anytime after
all refinements are finished.

-- 
Timothy

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





reply via email to

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