diff --git a/src/decentralizepy/communication/Communication.py b/src/decentralizepy/communication/Communication.py index 9240190b7901e3d877b0c4e51bb98b22be36ad0f..188af12f709439748f38e2280523c070bc3b01cd 100644 --- a/src/decentralizepy/communication/Communication.py +++ b/src/decentralizepy/communication/Communication.py @@ -102,4 +102,4 @@ class Communication: to_send = self.encrypt(data) id = str(uid).encode() self.peer_sockets[id].send(to_send) - print("Message sent") + print("{} sent the message to {}.".format(self.uid, uid)) diff --git a/testing.py b/testing.py index 5d487bd3a7914c7973c9f87322786478fa894d22..60581842b3ade0e635227bb058557852b9651174 100644 --- a/testing.py +++ b/testing.py @@ -7,11 +7,11 @@ from decentralizepy.mappings.Linear import Linear def f(rank, m_id, total_procs, filePath, mapping): c = Communication(rank, m_id, total_procs, filePath, mapping) - c.connect_neighbours([i for i in range(total_procs) if i != mapping.get_uid(rank, m_id)]) + c.connect_neighbours([i for i in range(total_procs) if i != c.uid]) send = {} send["message"] = "Hi I am rank {}".format(rank) - c.send((rank + 1) % total_procs, send) - print(rank, c.receive()) + c.send((c.uid + 1) % total_procs, send) + print(c.uid, c.receive()) if __name__ == "__main__":