def buildProtocol(self, addr): proto = FreenetClientProtocol() proto.factory = self proto.timeout = self.args.timeout #Register a callback for the NodeHello in order to send messages #once the transport is established. class StartProbes: def __init__(self, proto, args): self.proto = proto self.args = args def callback(self, message): delay_per = self.args.probeWait / self.args.numThreads def start(i): logging.debug("Starting probe instance {0}.".format(i)) SendLoop(self.proto, self.args) for i in range(self.args.numThreads): reactor.callLater(delay_per * i, start, i) proto.deferred['NodeHello'] = StartProbes(proto, self.args) proto.deferred['ProtocolError'] = Complain() return proto
def buildProtocol(self, _): proto = FreenetClientProtocol() proto.factory = self proto.timeout = self.config['timeout'] proto.deferred['NodeHello'] = self self.sendLoop = LoopingCall(SendHook, self.config, proto, self.conn) return proto
def buildProtocol(self, addr): proto = FreenetClientProtocol() proto.factory = self proto.timeout = self.args.timeout proto.deferred['NodeHello'] = self proto.deferred['ProtocolError'] = Complain() self.sendLoop = LoopingCall(SendHook, self.args, proto, self.pool) return proto
def buildProtocol(self, addr): log("Connecting.") proto = FreenetClientProtocol() proto.factory = self self.proto = proto proto.deferred['NodeHello'].addCallback(self.Insert) proto.deferred['PutFetchable'].addCallback(self.PutFetchable) proto.deferred['ProtocolError'].addCallback(self.ProtocolError) proto.deferred['IdentifierCollision'].addCallback(self.IdentifierCollision) return proto
def buildProtocol(self, addr): log("Connecting as {0}.".format(self.Identifier)) proto = FreenetClientProtocol() proto.factory = self self.proto = proto proto.deferred['NodeHello'].addCallback(self.Insert) proto.deferred['PutFetchable'].addCallback(self.PutFetchable) proto.deferred['PutSuccessful'].addCallback(self.PutSuccessful) proto.deferred['PutFailed'].addCallback(self.PutFailed) proto.deferred['ProtocolError'].addCallback(self.ProtocolError) proto.deferred['IdentifierCollision'].addCallback(self.IdentifierCollision) return proto
def buildProtocol(self, addr): log("Connecting as {0}.".format(self.Identifier)) proto = FreenetClientProtocol() proto.factory = self self.proto = proto proto.deferred['NodeHello'].addCallback(self.Insert) proto.deferred['PutFetchable'].addCallback(self.PutFetchable) proto.deferred['PutSuccessful'].addCallback(self.PutSuccessful) proto.deferred['PutFailed'].addCallback(self.PutFailed) proto.deferred['ProtocolError'].addCallback(self.ProtocolError) proto.deferred['IdentifierCollision'].addCallback( self.IdentifierCollision) return proto