Skip to content
Snippets Groups Projects
Commit c9f393b8 authored by Jeffrey Zhang's avatar Jeffrey Zhang
Browse files

Fix typo bugs

parent fbeea14b
No related branches found
No related tags found
1 merge request!1Fix typos
......@@ -33,7 +33,7 @@ class MyTCPHandler(socketserver.BaseRequestHandler):
obj.receive_action(td)
td.received_messages.add(obj.message_id)
reliable_multicast_messages = {client_name: replace(obj, receiver=client_name) for client_name in td.client_sockets
reliable_multicast_messages = {client_name: replace(obj, receiver=client_name) for client_name in td.client_sockets.keys()
if client_name!=self.client_name and client_name!=td.node_name
}
......
......@@ -52,7 +52,7 @@ class TransactionDeliverer:
def new_transaction_message(self, transaction: Transaction):
# Receives a transaction and builds the message to be sending out to all other nodes
print("Sending message")
transaction_message = TransactionMessage(self.node_name, self.node_name, str(uuid4()), transaction, False)
transaction_message = TransactionMessage(self.node_name, self.node_name, transaction, str(uuid4()), False)
# ISIS - propose a priority higher than those the node has already proposed or seen
proposed_priority = self.next_priority
......@@ -64,7 +64,7 @@ class TransactionDeliverer:
self.transactions_id_map[transaction_message.transaction_ID] = queue_item
transaction_messages = {client_name: replace(transaction_message, receiver=client_name)
for client_name in self.client_sockets.items()
for client_name in self.client_sockets.keys()
}
self.multicast(transaction_messages)
......@@ -74,14 +74,14 @@ class TransactionDeliverer:
self.client_sockets[transaction_message.sender].sendall(
pickle.dumps(
ProposedPriorityMessage(self.node_name, transaction_message.sender, transaction_message.id, proposed_priority)
ProposedPriorityMessage(self.node_name, transaction_message.sender, transaction_message.transaction_ID, proposed_priority)
)
)
queue_item = _Transaction_Message_Queue_Item(proposed_priority, self.node_name, transaction_message, 1)
self.transactions_queue.append(queue_item)
self.transactions_queue.sort()
self.transactions_id_map[transaction_message.id] = queue_item
self.transactions_id_map[transaction_message.transaction_ID] = queue_item
def process_proposed_priority_message(self, proposed_priority_message: ProposedPriorityMessage):
queue_item = self.transactions_id_map[proposed_priority_message.transaction_ID]
......@@ -96,7 +96,7 @@ class TransactionDeliverer:
agreed_priority_message = AgreedPriorityMessage(self.node_name,self.node_name,proposed_priority_message.transaction_ID,queue_item.priority)
agreed_priority_messages = {client_name: replace(agreed_priority_messages, receiver=client_name)
for client_name in self.client_sockets
for client_name in self.client_sockets.keys()
}
self.multicast(agreed_priority_messages)
......
......@@ -42,9 +42,9 @@ def process_inputs(td: TransactionDeliverer):
for line in sys.stdin:
line = line.split(' ')
if line[0] == "DEPOSIT":
transaction = Transaction(TransactionType.DEPOSIT, line[2], line[1])
transaction = Transaction(TransactionType.DEPOSIT, int(line[2].strip()), line[1])
elif line[0] == "TRANSFER":
transaction = Transaction(TransactionType.TRANSFER, line[4], line[3], line[1])
transaction = Transaction(TransactionType.TRANSFER, int(line[4].strip()), line[3], line[1])
else:
# Should never happen!
raise NotImplementedError("Unknown command")
......
2
node1 localhost 4285
node2 localhost 4286
\ No newline at end of file
node1 localhost 4281
node2 localhost 4282
\ 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