Skip to content

Commit

Permalink
- Updated LICENSE.txt to include original BitTorrrent LICENSE. BitTor…
Browse files Browse the repository at this point in the history
…nado

  also has this license. Replaced our BSD license with a Python-style license.
  
- Added license reference to Tribler/* files.

- All debug output now goes to stderr, such that it will be written to
  a file by py2exe. If there is debug output you want to see, set 
  DEBUG = True in the relevant files. To be replaced with logger solution
  in the future, although this is very non-invasive.
  
- Moved all Tribler dialogs to the Tribler/ directory.

- Fixed bug where torrent would not be completely removed from ABC admin
  when user closed its client while helping.




git-svn-id: https://svn.tribler.org/abc/branches/arno/d06-01-20-secover-f-jie-abc310-buddycast-dlhelp-r367@502 001aeff7-3401-0410-a489-f7902fc005dd
  • Loading branch information
arno committed Feb 8, 2006
1 parent 0683703 commit 4799569
Show file tree
Hide file tree
Showing 38 changed files with 467 additions and 430 deletions.
8 changes: 4 additions & 4 deletions ABC/Actions/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from Dialogs.aboutme import AboutMeDialog, VersionDialog
from Dialogs.abcoption import ABCOptionDialog
from Dialogs.localupload import LocalSettingDialog
from Dialogs.abcbuddyframe import ABCBuddyFrame
from Dialogs.abcfileframe import ABCFileFrame
from Dialogs.managefriends import ManageFriendsDialog
from Dialogs.managefriends import MyInfoDialog
from Tribler.Dialogs.abcbuddyframe import ABCBuddyFrame
from Tribler.Dialogs.abcfileframe import ABCFileFrame
from Tribler.Dialogs.managefriends import ManageFriendsDialog
from Tribler.Dialogs.managefriends import MyInfoDialog
from webservice import WebDialog

from Utility.helpers import stopTorrentsIfNeeded
Expand Down
41 changes: 14 additions & 27 deletions ABC/Torrent/abctorrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ def updateColumns(self, columnlist = None, force = False):

if DEBUG:
if threading.currentThread().getName() != "MainThread":
print "abctorrent: updateColumns thread",threading.currentThread()
print "abctorrent: NOT MAIN THREAD"
print >> sys.stderr,"abctorrent: updateColumns thread",threading.currentThread()
print >> sys.stderr,"abctorrent: NOT MAIN THREAD"
print_stack()

if columnlist is None:
Expand Down Expand Up @@ -492,7 +492,7 @@ def updateColumns(self, columnlist = None, force = False):
self.list.SetStringItem(self.listindex, rank, text)

except wx.PyDeadObjectError, msg:
print "error updateColumns:", msg
print >> sys.stderr,"error updateColumns:", msg
pass

#
Expand All @@ -512,11 +512,10 @@ def updateColor(self, force = False):

if DEBUG:
if threading.currentThread().getName() != "MainThread":
print "abctorrent: updateColour thread",threading.currentThread()
print "colour NOT MAIN THREAD"
print >> sys.stderr,"abctorrent: updateColour thread",threading.currentThread()
print >> sys.stderr,"colour NOT MAIN THREAD"
print_stack()

# print "<<< enter updateColor"
# Don't do anything if ABC is shutting down
if self.status.dontupdate:
return
Expand All @@ -525,8 +524,6 @@ def updateColor(self, force = False):
if not self.utility.frame.GUIupdate:
return

# print "updateColor 1"

colorString = None
if self.connection.engine is not None:
colorString = self.connection.engine.color
Expand All @@ -536,17 +533,13 @@ def updateColor(self, force = False):

color = self.utility.config.Read(colorString, "color")

# print "updateColor 2"

# Update color
if (self.utility.config.Read('stripedlist', "boolean")) and (self.listindex % 2):
bgcolor = self.utility.config.Read('color_stripe', "color")
else:
# Use system specified background:
bgcolor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)

# print "updateColor 3"

# Only update the color if it has changed
# (or if the force flag is set to True)
if (force
Expand All @@ -556,24 +549,17 @@ def updateColor(self, force = False):
or color != self.color['text']):

try:
# print "updateColor 4"
item = self.list.GetItem(self.listindex)
# print "updateColor 5"
item.SetTextColour(color)
# print "updateColor 6"
item.SetBackgroundColour(bgcolor)
# print "updateColor 7"
self.list.SetItem(item)
# print "updateColor 8"

self.color['text'] = color
self.color['bgcolor'] = bgcolor
except:
# print "updateColor except error"
self.color['text'] = None
self.color['bgcolor'] = None

# print ">>> leave updateColor"

#
# Update the fields that change frequently
Expand All @@ -582,8 +568,8 @@ def updateColor(self, force = False):
def updateSingleItemStatus(self):

if threading.currentThread().getName() != "MainThread":
print "abctorrent: updateSingleItem thread",threading.currentThread()
print "abctorrent: NOT MAIN THREAD"
print >> sys.stderr,"abctorrent: updateSingleItem thread",threading.currentThread()
print >> sys.stderr,"abctorrent: NOT MAIN THREAD"
print_stack()


Expand Down Expand Up @@ -649,8 +635,8 @@ def getInfo(self, fieldlist = None):
def updateScrapeData(self, newpeer, newseed, message = ""):

if threading.currentThread().getName() != "MainThread":
print "abctorrent: updateScrapeData thread",threading.currentThread()
print "abctorrent: NOT MAIN THREAD"
print >> sys.stderr,"abctorrent: updateScrapeData thread",threading.currentThread()
print >> sys.stderr,"abctorrent: NOT MAIN THREAD"
print_stack()


Expand All @@ -659,7 +645,8 @@ def updateScrapeData(self, newpeer, newseed, message = ""):
self.totalseeds = newseed
self.updateColumns([COL_SEEDS, COL_PEERS])
if message != "":
print "message: " + message
if DEBUG:
print >> sys.stderr,"message: " + message

if message == self.utility.lang.get('scraping'):
msgtype = "status"
Expand All @@ -686,8 +673,8 @@ def updateScrapeData(self, newpeer, newseed, message = ""):
def changeMessage(self, message = "", type = "clear"):

if threading.currentThread().getName() != "MainThread":
print "abctorrent: updateScrapeData thread",threading.currentThread()
print "abctorrent: NOT MAIN THREAD"
print >> sys.stderr,"abctorrent: updateScrapeData thread",threading.currentThread()
print >> sys.stderr,"abctorrent: NOT MAIN THREAD"
print_stack()


Expand Down Expand Up @@ -791,6 +778,6 @@ def shutdown(self):
except:
pass
self.files.removeFiles()
##self.utility.torrents["all"].remove(self)
self.utility.torrents["all"].remove(self)

del self.utility.torrents["inactive"][self]
2 changes: 1 addition & 1 deletion BitTornado/BT1/Encrypter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
MAX_INCOMPLETE = 8

protocol_name = 'BitTorrent protocol'
# Enable I-Share extensions:
# Enable Tribler extensions:
# Left-most bit = Azureus Enhanced Messaging Protocol (AEMP)
# Left+42 bit = Tribler Overlay swarm extension
# Left+43 bit = Tribler Simple Merkle Hashes extension
Expand Down
10 changes: 5 additions & 5 deletions BitTornado/BT1/PiecePicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
from BitTornado.clock import clock
# 2fastbt_
from Tribler.toofastbt.Logger import get_logger
from sys import exc_info
from traceback import extract_tb
import sys
# _2fastbt
try:
True
except:
True = 1
False = 0

DEBUG = True
DEBUG = False

class PiecePicker:
# 2fastbt_
Expand Down Expand Up @@ -218,20 +218,20 @@ def next(self, haves, wantfunc, sdownload, complete_first = False, helper_con =
piece = self._next(haves, wantfunc, complete_first, helper_con)
if piece is None:
if DEBUG:
print "PiecePicker: _next returned no pieces!",
print >> sys.stderr,"PiecePicker: _next returned no pieces!",
break
if self.helper is None or helper_con:
return piece

if self.helper.reserve_piece(piece,sdownload):
if DEBUG:
print "helper: reserve SHOULD DL PIECE",piece
print >> sys.stderr,"helper: reserve SHOULD DL PIECE",piece
return piece
else:
return None

if DEBUG:
print "helper: NONE SHOULD DL PIECE",piece
print >> sys.stderr,"helper: NONE SHOULD DL PIECE",piece
return piece
if self.rate_predictor is None or not self.rate_predictor.has_capacity():
return None
Expand Down
20 changes: 10 additions & 10 deletions BitTornado/RawServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
True = 1
False = 0

DEBUG = True
DEBUG = False

def autodetect_ipv6():
try:
Expand Down Expand Up @@ -137,7 +137,7 @@ def listen_forever(self, handler):
events = self.sockethandler.do_poll(period)
if self.doneflag.isSet():
if DEBUG:
print "rawserver: stopping because done flag set"
print >> sys.stderr,"rawserver: stopping because done flag set"
return
while self.funcs and self.funcs[0][0] <= clock():
garbage1, func, id = self.funcs.pop(0)
Expand All @@ -147,7 +147,7 @@ def listen_forever(self, handler):
# print func.func_name
if DEBUG:
if func.func_name != "_bgalloc":
print "RawServer: calling (not bgalloc)",func.func_name
print >> sys.stderr,"RawServer: calling (not bgalloc)",func.func_name
func()
except (SystemError, MemoryError), e:
self.failfunc(str(e))
Expand All @@ -157,29 +157,29 @@ def listen_forever(self, handler):
return
except error:
if DEBUG:
print "rawserver: func: ERROR exception"
print >> sys.stderr,"rawserver: func: ERROR exception"
print_exc()
except:
if DEBUG:
print "rawserver: func: any exception"
print >> sys.stderr,"rawserver: func: any exception"
print_exc()
if self.noisy:
self.exception()
self.sockethandler.close_dead()
self.sockethandler.handle_events(events)
if self.doneflag.isSet():
if DEBUG:
print "rawserver: stopping because done flag set2"
print >> sys.stderr,"rawserver: stopping because done flag set2"
return
self.sockethandler.close_dead()
except (SystemError, MemoryError), e:
if DEBUG:
print "rawserver: SYS/MEM exception",e
print >> sys.stderr,"rawserver: SYS/MEM exception",e
self.failfunc(str(e))
return
except error:
if DEBUG:
print "rawserver: ERROR exception"
print >> sys.stderr,"rawserver: ERROR exception"
print_exc()
if self.doneflag.isSet():
return
Expand All @@ -188,12 +188,12 @@ def listen_forever(self, handler):
return
except:
if DEBUG:
print "rawserver: other exception"
print >> sys.stderr,"rawserver: other exception"
print_exc()
self.exception()
## Arno: Don't stop till we drop
##if self.exccount > 10:
## print "rawserver: stopping because exccount > 10"
## print >> sys.stderr,"rawserver: stopping because exccount > 10"
## return
finally:
# self.sockethandler.shutdown()
Expand Down
Loading

0 comments on commit 4799569

Please sign in to comment.