Commit 5c64f8ce authored by 's avatar
Browse files

un peu de lisibilité en plus

parent 0ea78a83
......@@ -66,7 +66,8 @@ class LamportClient:
self.initializeCycle, self.init_reception)
self.channel.basic_publish(
exchange="lamport_init", body = "{} says : Hello World!".format(self.id), routing_key='')
exchange="lamport_init",
body = "{} says : Hello World!".format(self.id), routing_key='')
print("saying hello to the world")
self.channel.start_consuming()
......@@ -91,11 +92,12 @@ class LamportClient:
#client.free()
def initializeCycle(self, channel, method, properties, body):
#_,body,_ = str(body).split("'")
_,body,_ = str(body).split("'")
arrival_id = int(body.split(" ")[0])
self.n_clients_here += 1
print("{} arrived!\nWe are now {} of {}".format(arrival_id, self.n_clients_here, self.n_clients_total))
print("{} arrived!\nWe are now {} of {}".format(
arrival_id, self.n_clients_here, self.n_clients_total))
if self.n_clients_here == self.n_clients_total:
self.channel.stop_consuming()
......@@ -105,7 +107,8 @@ class LamportClient:
"""publish
send message to server
"""
self.channel.basic_publish(exchange = "lamport", body=message, routing_key='')
self.channel.basic_publish(
exchange = "lamport", body=message, routing_key='')
def request(self):
"""request
......@@ -152,7 +155,7 @@ class LamportClient:
def when_receive(self, channel, method, properties, body):
body = str(body)
#_,body,_ = body.split("'")
_,body,_ = body.split("'")
print("received {}".format(body))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment