コード例 #1
0
	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
コード例 #2
0
    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
コード例 #3
0
    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
コード例 #4
0
ファイル: probe.py プロジェクト: adambarthelson/pyProbe
	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
コード例 #5
0
ファイル: analyze.py プロジェクト: adambarthelson/pyProbe
    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
コード例 #6
0
ファイル: analyze.py プロジェクト: ArneBab/pyProbe
    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
コード例 #7
0
    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