Skip to content
Snippets Groups Projects
Commit 48b748ad authored by WinJ's avatar WinJ
Browse files

Merge remote-tracking branch 'origin/new_main'

parents 312e5cc6 157d44d0
No related branches found
No related tags found
No related merge requests found
......@@ -29,8 +29,8 @@ if __name__ == "__main__":
# create a UDP socket
HOST, PORT = "localhost", 9000
# TODO: Uncomment below for multiple nodes paxos
# serv_addresses = ((HOST, PORT), (HOST, PORT + 1), (HOST, PORT + 2))
serv_addresses = ((HOST, PORT), )
serv_addresses = ((HOST, 9000), (HOST, 9001))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('localhost', 0))
address = sock.getsockname()
......
......@@ -45,11 +45,9 @@ class LockManager:
lock_res = self.lock(int(lock_command.value), client_address)
elif lock_command.op == "unlock":
lock_res = self.unlock(int(lock_command.value), client_address)
print("Current Locks: {}".format(self.locks))
print(f"Current Locks: {self.locks}")
return lock_res
# quick_test
#if __name__ == "__main__":
#lm = LockManager()
......
......@@ -430,11 +430,12 @@ def send_msg(obj, dest_addr: Address):
sock.close()
if __name__ == "__main__":
HOST, PORT = "localhost", 9000
# addresses = ((HOST, PORT), (HOST, PORT + 1), (HOST, PORT + 2))
addresses = ((HOST, PORT),)
HOST, PORT = sys.argv[1], int(sys.argv[2])
# addresses = ((HOST, PORT),)
addresses = ((HOST, 9000), (HOST, 9001))
# Create the server, binding to localhost on port 9999
server = Paxos((HOST, PORT), addresses)
# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
server.serve_forever()
server.serve_forever()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment