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,6 +246,7 @@ class DelugeRPCProtocol(Protocol):
Sends an error response with the contents of the exception that was raised. Sends an error response with the contents of the exception that was raised.
""" """
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info() exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
try:
self.sendData(( self.sendData((
RPC_ERROR, RPC_ERROR,
request_id, request_id,
@ -254,6 +255,11 @@ class DelugeRPCProtocol(Protocol):
exceptionValue._kwargs, exceptionValue._kwargs,
"".join(traceback.format_tb(exceptionTraceback)) "".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": if method == "daemon.info":
# This is a special case and used in the initial connection process # This is a special case and used in the initial connection process

View File

@ -189,14 +189,14 @@ class Torrent(object):
else: else:
self.owner = owner self.owner = owner
# Keep trac of last seen complete # Keep track of last seen complete
if state: if state:
self._last_seen_complete = state.last_seen_complete or 0.0 self._last_seen_complete = state.last_seen_complete or 0.0
else: else:
self._last_seen_complete = 0.0 self._last_seen_complete = 0.0
# Keep track if we're forcing a recheck of the torrent so that we can # 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 = False
self.forcing_recheck_paused = False self.forcing_recheck_paused = False
@ -359,7 +359,7 @@ class Torrent(object):
# Set the tracker list in the torrent object # Set the tracker list in the torrent object
self.trackers = trackers self.trackers = trackers
if len(trackers) > 0: 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.force_reannounce()
self.tracker_host = None self.tracker_host = None