Author: damoxc

Revision: 5660

Log:
        stop using get_stats and fix the protocol overheads in the statusbar

Diff:
Modified: trunk/deluge/ui/web/js/Deluge.Statusbar.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Statusbar.js  2009-08-12 00:43:40 UTC (rev 
5659)
+++ trunk/deluge/ui/web/js/Deluge.Statusbar.js  2009-08-12 00:59:19 UTC (rev 
5660)
@@ -120,11 +120,11 @@
                        
                        updateStat('traffic', {
                                value: {
-                                       value: stats.payload_download_rate,
+                                       value: stats.download_rate - 
stats.payload_download_rate,
                                        formatter: Deluge.Formatters.speed
                                },
                                limit: {
-                                       value: stats.payload_upload_rate,
+                                       value: stats.upload_rate - 
stats.payload_upload_rate,
                                        formatter: Deluge.Formatters.speed
                                },
                                format: '{0}/{1}'

Modified: trunk/deluge/ui/web/json_api.py
===================================================================
--- trunk/deluge/ui/web/json_api.py     2009-08-12 00:43:40 UTC (rev 5659)
+++ trunk/deluge/ui/web/json_api.py     2009-08-12 00:59:19 UTC (rev 5660)
@@ -49,6 +49,7 @@
 from deluge.configmanager import ConfigManager
 from deluge.ui import common as uicommon
 from deluge.ui.client import client, Client
+from deluge.ui.coreconfig import CoreConfig
 
 from deluge.ui.web.common import _
 json = common.json
@@ -133,6 +134,7 @@
             d = client.daemon.get_method_list()
             d.addCallback(on_get_methods)
             component.get("Web.PluginManager").start()
+            component.get("Web").core_config.start()
         _d.addCallback(on_client_connected)
         return d
 
@@ -315,6 +317,7 @@
     def __init__(self):
         super(WebApi, self).__init__("Web")
         self.host_list = ConfigManager("hostlist.conf.1.2", DEFAULT_HOSTS)
+        self.core_config = CoreConfig()
 
     def get_host(self, host_id):
         """
@@ -386,15 +389,22 @@
         ui_info = {
             "torrents": None,
             "filters": None,
-            "stats": None
+            "stats": {
+                "max_download": self.core_config.get("max_download_speed"),
+                "max_upload": self.core_config.get("max_upload_speed"),
+                "max_num_connections": 
self.core_config.get("max_connections_global")
+            }
         }
         
         if not client.connected():
             d.callback(ui_info)
             return d
         
+        def got_connections(connections):
+            ui_info["stats"]["num_connections"] = connections
+        
         def got_stats(stats):
-            ui_info["stats"] = stats
+            ui_info["stats"].update(stats)
 
         def got_filters(filters):
             ui_info["filters"] = filters
@@ -411,10 +421,14 @@
         d2 = client.core.get_filter_tree()
         d2.addCallback(got_filters)
 
-        d3 = client.core.get_stats()
+        d3 = client.core.get_session_status(["payload_download_rate", 
"payload_upload_rate",
+                "dht_nodes", "has_incoming_connections", "download_rate", 
"upload_rate"])
         d3.addCallback(got_stats)
+        
+        d4 = client.core.get_num_connections()
+        d4.addCallback(got_connections)
 
-        dl = DeferredList([d1, d2, d3], consumeErrors=True)
+        dl = DeferredList([d1, d2, d3, d4], consumeErrors=True)
         dl.addCallback(on_complete)
         return d
 



--~--~---------~--~----~------------~-------~--~----~
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