Ticket #1466: 0001-fix-send-buffer-watermark-too-low-warnings.patch

File 0001-fix-send-buffer-watermark-too-low-warnings.patch, 2.1 KB (added by tyeken8, 8 years ago)
  • deluge/core/torrentmanager.py

    From 909d048f84ea84e67402fe21f49e60177b9d0eb3 Mon Sep 17 00:00:00 2001
    From: Tydus <Tydus@Tydus.org>
    Date: Mon, 3 Dec 2012 16:17:42 +0800
    Subject: [PATCH] fix "send buffer watermark too low" warnings
    
    1) Double the buffer only if the performance warning is about that.
    2) Change cap to 50MB, since it seems the send buffer watermark should be
    roughly your max upload per second.
    eg. If your max upload bandwith is 12MB/s(100Mbps),
        the buffer of 13107200(12.5MB) should be OK.
    ---
     deluge/core/torrentmanager.py |   19 +++++++++++++++++++
     1 file changed, 19 insertions(+)
    
    diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
    index fee10dc..65138c1 100644
    a b def __init__(self): 
    197197            self.on_alert_file_error) 
    198198        self.alerts.register_handler("file_completed_alert", 
    199199            self.on_alert_file_completed) 
     200        self.alerts.register_handler("performance_alert", 
     201            self.on_alert_performance) 
    200202 
    201203    def start(self): 
    202204        # Get the pluginmanager reference 
    def on_alert_file_completed(self, alert): 
    11291131            return 
    11301132        component.get("EventManager").emit( 
    11311133            TorrentFileCompletedEvent(torrent_id, alert.index)) 
     1134 
     1135    def on_alert_performance(self, alert): 
     1136        log.debug("performance_alert: %s", alert.message()) 
     1137        try: 
     1138            if alert.message().endswith("send buffer watermark too low (upload rate will suffer)"): 
     1139                # if send buffer is too small, try doubling its size 
     1140                settings = component.get("Core").session.settings() 
     1141                # cap buffer at 50MiB 
     1142                if settings.send_buffer_watermark <= 26214400: 
     1143                    log.debug("send_buffer_watermark set to %s..", 
     1144                        2 * settings.send_buffer_watermark) 
     1145                    setattr(settings, "send_buffer_watermark", 
     1146                        2 * settings.send_buffer_watermark) 
     1147                    self.session.set_settings(settings) 
     1148 
     1149        except: 
     1150            return