Hi Burak, On Tue, Aug 20, 2013 at 12:21 PM, Burak Nehbit <bu...@nehbit.net> wrote:
> Hi there, > > I was meaning to ask you all about the 'proper' way to use AMP in regards > to two–way communication. The problem I am facing is quite simple, I am > building a simple peer–to–peer network in which the user: > > a) When sent a handshake, returns a handshake, > b) When asked for fingerprints of posts in the local, returns it, and then > asks for the same thing, > and finally, c) If any of the fingerprints do not match posts, request > those posts with the fingerprint. > > The only non–symmetric step I have in my protocol is the last one. > > My question is, should I send my responses over the same AMP command as a > response to the command requested, or should I just return an ACK (a > boolean value of true, to confirm receipt) and then initiate a separate AMP > request from local to the same remote? > Keep in mind that AMP commands are always ack'ed without you needing to specify any kind of value, unless you set requiresResponse = False on the Command class. That would mean I would need to handle my open–connections pool by myself, > to prevent posts from a non–initiated machine being accepted into the local > machine, but I do need to implement that anyway due to the complexity of my > business rules. I don't understand this part. It sounds like an authentication problem, no? > At that point, it seems that I am (Am I?) just using AMP as a remote > method header I don't strictly need, and I could just use LineReceiver—all > my data is text—to do my bidding. > It's usually correct that you can do things with LineReceiver, but it's also usually true that AMP is doing stuff for you ;) Some more information about your system would be useful. Are posts append-only? Would it make sense to have a given serialization of them? If so, a hash chain would allow you to sync with just one hash value. A consensus protocol might help you figure out what that serialization is. cheers lvh
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python