|
@@ -145,11 +145,11 @@ class ClientChannelManager(relay.ChannelManager):
|
|
|
def new_circuit(self):
|
|
|
"""Create a new circuit from this client."""
|
|
|
if network.thenetwork.womode == network.WOMode.VANILLA:
|
|
|
- print("creating enw circuit of type " + network.WOMODE.VANILLA)
|
|
|
return self.new_circuit_vanilla()
|
|
|
elif network.thenetwork.womode == network.WOMode.TELESCOPING:
|
|
|
return self.new_circuit_telescoping()
|
|
|
- #TODO create a new circuit for single-pass
|
|
|
+ elif network.thenetwork.womode == network.WOMode.SINGLEPASS:
|
|
|
+ sys.exit("NOT YET IMPLEMENTED")
|
|
|
|
|
|
def received_msg(self, msg, peeraddr, channel):
|
|
|
"""Callback when a NetMsg not specific to a circuit is
|
|
@@ -202,6 +202,7 @@ class Client:
|
|
|
# we'll need a consensus (uh, oh; in that case, fetch the
|
|
|
# consensus from a fallback relay).
|
|
|
|
|
|
+
|
|
|
guardaddr = self.channelmgr.guardaddr
|
|
|
guardchannel = None
|
|
|
if guardaddr is not None:
|
|
@@ -211,14 +212,24 @@ class Client:
|
|
|
guardaddr = None
|
|
|
|
|
|
if guardchannel is None:
|
|
|
+ print("In bootstrapping mode")
|
|
|
self.channelmgr.get_consensus_from_fallbackrelay()
|
|
|
- else:
|
|
|
- if self.channelmgr.consensus is not None and \
|
|
|
- len(self.channelmgr.consensus.consdict['relays']) > 0:
|
|
|
+ print('client consensus=', self.channelmgr.consensus)
|
|
|
+ return
|
|
|
+
|
|
|
+ if network.thenetwork.womode == network.WOMode.VANILLA:
|
|
|
+ if self.channelmgr.consensus is not None and len(self.channelmgr.consensus.consdict['relays']) > 0:
|
|
|
guardchannel.send_msg(relay.RelayGetConsensusDiffMsg())
|
|
|
- else:
|
|
|
- guardchannel.send_msg(relay.RelayGetConsensusMsg())
|
|
|
+ print('got consensus diff, client consensus=', self.channelmgr.consensus)
|
|
|
+ return
|
|
|
+
|
|
|
+ # At this point, we are in one of the following scenarios:
|
|
|
+ # 1. This is a walking onions protocol, and the client fetches the
|
|
|
+ # complete consensus each epoch
|
|
|
+ # 2. This is Vanilla Onion Routing and the client doesn't have a
|
|
|
+ # consensus and needs to bootstrap it.
|
|
|
|
|
|
+ guardchannel.send_msg(relay.RelayGetConsensusMsg())
|
|
|
print('client consensus=', self.channelmgr.consensus)
|
|
|
|
|
|
def newepoch(self, epoch):
|