Permalink
Browse files

added new logging options

  • Loading branch information...
1 parent 3bcb71f commit 0dc8f2ecc86b2b0df63e36647535800f407bafd6 BuzzTroll committed Sep 10, 2010
Showing with 17 additions and 3 deletions.
  1. +1 −1 lantorrent/etc/lt.ini
  2. +1 −1 lantorrent/pylantorrent/__init__.py
  3. +15 −1 lantorrent/pylantorrent/daemon.py
@@ -2,7 +2,7 @@
password=nimbus
[log]
-file=@LANTORRENT_HOME@/log/lantorrent.log
+file=@LANTORRENT_HOME@/log/lantorrent.@PGM@.log
level=debug
[db]
file=@LANTORRENT_HOME@/etc/req.db
@@ -81,7 +81,7 @@ def load_settings(self, ini_file):
s = SafeConfigParser()
s.readfp(open(ini_file, "r"))
self.pw = s.get("security", "password")
- self.logfile = s.get("log", "file").replace("@LANTORRENT_HOME@", self.lt_home)
+ self.logfile = s.get("log", "file").replace("@LANTORRENT_HOME@", self.lt_home).replace("@PGM@", sys.argv[0])
try:
log_level_str = s.get("log", "level")
self.log_level = log_levels[log_level_str]
@@ -27,6 +27,19 @@ def getrows(con):
# select
con.commit()
+ s = "select max(entry_time) from requests where src_filename = ? and state = 0 and attempt_count < 3"
+ data = (src_file, )
+ done = False
+ while not done:
+ c.execute(s, data)
+ row = c.fetchone()
+ con.commit()
+ td = datetime.datetime.now() - datetime.timedelta(0, 2)
+ if row[0] < td:
+ done = True
+ else:
+ time.sleep(0.1)
+
s = "select hostname,port,src_filename,dst_filename,rid from requests where src_filename = ? and state = 0 and attempt_count < 3 order by hostname,port"
data = (src_file, )
c.execute(s, data)
@@ -134,7 +147,8 @@ def main(argv=sys.argv[1:]):
con_str = pylantorrent.config.dbfile
now = datetime.datetime.now()
- con = sqlite3.connect(con_str, isolation_level="EXCLUSIVE")
+ #con = sqlite3.connect(con_str, isolation_level="EXCLUSIVE")
+ con = sqlite3.connect(con_str)
done = False
while not done:

0 comments on commit 0dc8f2e

Please sign in to comment.