Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def log(self, *args, **kwargs):
kwargs['parent'] = self._logparent
kwargs['facility'] = "foolscap.negotiation"
return log.msg(*args, **kwargs)
def log(self, *args, **kwargs):
kwargs['tubID'] = self.tubID
return log.msg(*args, **kwargs)
def start(self, count):
if self.debug:
log.msg("%s.start: %s" % (self, count))
self.numargs = None
self.args = []
self.kwargs = {}
self.argname = None
self.argConstraint = None
self.num_unreferenceable_children = 0
self._all_children_are_referenceable_d = None
self._ready_deferreds = []
self.closed = False
def __init__(self, parent, tubref):
self._logparent = log.msg(format="TubConnector created from "
"%(fromtubid)s to %(totubid)s",
fromtubid=parent.tubID,
totubid=tubref.getTubID(),
level=OPERATIONAL,
facility="foolscap.connection")
self.tub = parent
self.target = tubref
hints = []
# filter out the hints that we can actually use.. there may be
# extensions from the future sitting in this list
for h in self.target.getLocations():
if h[0] == "ipv4":
(host, port) = h[1:]
hints.append( (host, port) )
self.remainingLocations = hints
# attemptedLocations keeps track of where we've already tried to
def updateChild(self, obj, which):
# one of our arguments has just now become referenceable. Normal
# types can't trigger this (since the arguments to a method form a
# top-level serialization domain), but special Unslicers might. For
# example, the Gift unslicer will eventually provide us with a
# RemoteReference, but for now all we get is a Deferred as a
# placeholder.
if self.debug:
log.msg("%s.updateChild, [%s] became referenceable: %s" %
(self, which, obj))
if isinstance(which, int):
self.args[which] = obj
else:
self.kwargs[which] = obj
self.num_unreferenceable_children -= 1
if self.num_unreferenceable_children == 0:
if self._all_children_are_referenceable_d:
self._all_children_are_referenceable_d.callback(None)
return obj
% (self.reqID, self.rref, methname),
level=log.NOISY, parent=lp)
#stack = why.getTraceback()
# TODO: include the first few letters of the remote tubID in
# this REMOTE tag
#stack = "REMOTE: " + stack.replace("\n", "\nREMOTE: ")
log.msg(" the REMOTE failure was:", failure=why,
level=log.NOISY, parent=lp)
#log.msg(stack, level=log.NOISY, parent=lp)
self.deferred.errback(why)
else:
log.msg("WEIRD: fail() on an inactive request", traceback=True)
if self.failure:
log.msg("multiple failures")
log.msg("first one was:", self.failure)
log.msg("this one was:", why)
log.err("multiple failures indicate a problem")