Module: deluge
Branch: chunked-sessionproxy-and-gtkui-speedups
Commit: 89e34dbd7172f7e17f0319762d02f46fc95c0219

Author: Pedro Algarvio <[email protected]>
Date:   Sat May 28 16:27:26 2011 +0100

Log exception occurring while sending RPC errors to clients.

---

 deluge/core/rpcserver.py |   22 ++++++++++++++--------
 deluge/core/torrent.py   |    6 +++---
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/deluge/core/rpcserver.py b/deluge/core/rpcserver.py
index 24c894d..d176ff0 100644
--- a/deluge/core/rpcserver.py
+++ b/deluge/core/rpcserver.py
@@ -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
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 723b7c5..0b32d54 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -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

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to