Log exception occurring while sending RPC errors to clients.

This commit is contained in:
Pedro Algarvio 2011-05-28 16:27:26 +01:00
parent 042ddd2891
commit 4d4c6404b1
2 changed files with 17 additions and 11 deletions

View File

@ -246,14 +246,20 @@ class DelugeRPCProtocol(Protocol):
Sends an error response with the contents of the exception that was raised.
"""
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
self.sendData((
RPC_ERROR,
request_id,
exceptionType.__name__,
exceptionValue._args,
exceptionValue._kwargs,
"".join(traceback.format_tb(exceptionTraceback))
))
try:
self.sendData((
RPC_ERROR,
request_id,
exceptionType.__name__,
exceptionValue._args,
exceptionValue._kwargs,
"".join(traceback.format_tb(exceptionTraceback))
))
except Exception, err:
log.error("An exception occurred while sending RPC_ERROR to "
"client. Error to send(exception goes next): %s",
"".join(traceback.format_tb(exceptionTraceback)))
log.exception(err)
if method == "daemon.info":
# This is a special case and used in the initial connection process

View File

@ -189,14 +189,14 @@ class Torrent(object):
else:
self.owner = owner
# Keep trac of last seen complete
# Keep track of last seen complete
if state:
self._last_seen_complete = state.last_seen_complete or 0.0
else:
self._last_seen_complete = 0.0
# Keep track if we're forcing a recheck of the torrent so that we can
# repause it after its done if necessary
# re-pause it after its done if necessary
self.forcing_recheck = False
self.forcing_recheck_paused = False
@ -359,7 +359,7 @@ class Torrent(object):
# Set the tracker list in the torrent object
self.trackers = trackers
if len(trackers) > 0:
# Force a reannounce if there is at least 1 tracker
# Force a re-announce if there is at least 1 tracker
self.force_reannounce()
self.tracker_host = None