From d95201e3fa61d0a5397afda5a4b54860d281697e Mon Sep 17 00:00:00 2001
From: Fernando Erd <fce15@inf.ufpr.br>
Date: Tue, 8 Nov 2016 10:08:06 -0200
Subject: [PATCH] arrumando erro de ack e nack

---
 Canguru/tentandop.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Canguru/tentandop.py b/Canguru/tentandop.py
index d2c3017..1117803 100755
--- a/Canguru/tentandop.py
+++ b/Canguru/tentandop.py
@@ -187,11 +187,11 @@ def server ():
             RECEBIDA = 1
 
         #Erro no envio
-        if (msg[1] == '3' and int(MACHINE_ID) == int(protocolDescompactMessage.destiny)):
+        elif (msg[1] == '3' and int(MACHINE_ID) == int(protocolDescompactMessage.destiny)):
             RECEBIDA = 0
 
         #A msg e pra mim
-        if (msg[1] == '1' and int(MACHINE_ID) == int(protocolDescompactMessage.destiny)):
+        elif (msg[1] == '1' and int(MACHINE_ID) == int(protocolDescompactMessage.destiny)):
             #protocolDescompactMessage.crc = "8888888"#caga tdo
             if (protocolDescompactMessage.crc == protocolDescompactMessage.getCRC32()):
                 print '\n' + protocolDescompactMessage.origin + ' Escreveu: ' + protocolDescompactMessage.msg
@@ -211,7 +211,7 @@ def server ():
                 udp.sendto (msg, dest)
             
         #A msg n e pra mim
-        elif (msg[1] == '1'):
+        elif (msg[1] == '1' or msg[2] == '2' or msg[3] == '3'):
             udp.sendto (msg, dest)
        	
         #Recebi o token
@@ -233,6 +233,8 @@ print 'ID Dessa maquina, escolha entre 1 e 4'
 MACHINE_ID = raw_input ()
 print "Ip da proxima maquina"
 HOST = raw_input()
+if TOKEN == 1:
+    StartTime = time.time()
 threadServer = threading.Thread(target=server)
 threadClient = threading.Thread(target=client)
 threadToken = threading.Thread(target=token)
-- 
GitLab