fixed problem when parsing CHOKE, UNCHOKE, INTERESTED, NOT_INTERESTED
authorp2p@p2p-next-05.grid.pub.ro <razvan.deaconescu@cs.pub.ro>
Tue, 24 Nov 2009 13:43:37 +0000 (15:43 +0200)
committerp2p@p2p-next-05.grid.pub.ro <razvan.deaconescu@cs.pub.ro>
Tue, 24 Nov 2009 13:43:37 +0000 (15:43 +0200)
log-parser/libtorrent/LogParser.py

index a162e29..cdd2f8f 100644 (file)
@@ -27,7 +27,7 @@ bt_msg_types = {"CHOKE": 0, "UNCHOKE": 1, "INTERESTED": 2,
 
 log_msg_dir = {"RECEIVE": 0, "SEND": 1}
 
-DEBUG = False
+DEBUG = True
 
 LOG_YEAR=2009
 
@@ -52,9 +52,9 @@ def string_to_timestamp(date_string):
 #
 
 def libtorrent_parse_choke(line):
-    if string.find(line, "<== CHOKE ") != -1:
+    if string.find(line, "<== CHOKE") != -1:
         direction = log_msg_dir["RECEIVE"]
-    elif string.find(line, "==> CHOKE ") != -1:
+    elif string.find(line, "==> CHOKE") != -1:
         direction = log_msg_dir["SEND"]
     else:
         return None
@@ -80,9 +80,9 @@ def libtorrent_parse_choke(line):
 #    Jan 08 22:40:00 <== UNCHOKE
 
 def libtorrent_parse_unchoke(line):
-    if string.find(line, "<== UNCHOKE ") != -1:
+    if string.find(line, "<== UNCHOKE") != -1:
         direction = log_msg_dir["RECEIVE"]
-    elif string.find(line, "==> UNCHOKE ") != -1:
+    elif string.find(line, "==> UNCHOKE") != -1:
         direction = log_msg_dir["SEND"]
     else:
         return None
@@ -109,9 +109,9 @@ def libtorrent_parse_unchoke(line):
 #
 
 def libtorrent_parse_interested(line):
-    if string.find(line, "<== INTERESTED ") != -1:
+    if string.find(line, "<== INTERESTED") != -1:
         direction = log_msg_dir["RECEIVE"]
-    elif string.find(line, "==> INTERESTED ") != -1:
+    elif string.find(line, "==> INTERESTED") != -1:
         direction = log_msg_dir["SEND"]
     else:
         return None
@@ -138,9 +138,9 @@ def libtorrent_parse_interested(line):
 #
 
 def libtorrent_parse_not_interested(line):
-    if string.find(line, "<== NOT_INTERESTED ") != -1:
+    if string.find(line, "<== NOT_INTERESTED") != -1:
         direction = log_msg_dir["RECEIVE"]
-    elif string.find(line, "==> NOT_INTERESTED ") != -1:
+    elif string.find(line, "==> NOT_INTERESTED") != -1:
         direction = log_msg_dir["SEND"]
     else:
         return None