- def _check_end(self):
- """Stop the reactor if we got all the results.
-
- """
- if len(self.parent.results) == len(self.parent.nc):
- reactor.stop()
-
- def cb_call(self, obj):
- """Callback for successful connect.
-
- If the connect and login sequence succeeded, we proceed with
- making the actual call.
-
- """
- deferred = obj.callRemote(self.parent.procedure, self.parent.args)
- deferred.addCallbacks(self.cb_done, self.cb_err2)
-
- def cb_done(self, result):
- """Callback for successful call.
-
- When we receive the result from a call, we check if it was an
- error and if so we raise a generic RemoteError (we can't pass yet
- the actual exception over). If there was no error, we store the
- result.
-
- """
- tb, self.parent.results[self.node] = result
- self._check_end()
- if tb:
- raise errors.RemoteError("Remote procedure error calling %s on %s:"
- "\n%s" % (self.parent.procedure,
- self.node,
- tb))
-
- def cb_err1(self, reason):
- """Error callback for unsuccessful connect.
-
- """
- logger.Error("caller_connect: could not connect to remote host %s,"
- " reason %s" % (self.node, reason))
- self.parent.results[self.node] = False
- self._check_end()
-
- def cb_err2(self, reason):
- """Error callback for unsuccessful call.
-
- This is when the call didn't return anything, not even an error,
- or when it time out, etc.
-
- """
- logger.Error("caller_call: could not call %s on node %s,"
- " reason %s" % (self.parent.procedure, self.node, reason))
- self.parent.results[self.node] = False
- self._check_end()
-
-
-class MirrorContextFactory:
- """Certificate verifier factory.
-
- This factory creates contexts that verify if the remote end has a
- specific certificate (i.e. our own certificate).
-
- The checks we do are that the PEM dump of the certificate is the
- same as our own and (somewhat redundantly) that the SHA checksum is
- the same.
-
- """
- isClient = 1
-
- def __init__(self):