From 567ffa3e3fe99cd8fcc1626b687aa504df6e1dbf Mon Sep 17 00:00:00 2001 From: "p2p@p2p-next-05.grid.pub.ro" Date: Tue, 24 Nov 2009 15:43:37 +0200 Subject: [PATCH] fixed problem when parsing CHOKE, UNCHOKE, INTERESTED, NOT_INTERESTED --- log-parser/libtorrent/LogParser.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/log-parser/libtorrent/LogParser.py b/log-parser/libtorrent/LogParser.py index a162e29..cdd2f8f 100644 --- a/log-parser/libtorrent/LogParser.py +++ b/log-parser/libtorrent/LogParser.py @@ -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 -- 2.20.1