From 07d9a03bf7a5abb556cc3b4d59a4cca6d1ad05f2 Mon Sep 17 00:00:00 2001
From: Joshua Beck <jxb091000@utdallas.edu>
Date: Sun, 18 Dec 2011 03:55:44 -0600
Subject: [PATCH] fix "send buffer watermark too low" warnings
---
deluge/core/torrentmanager.py | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 43ea994..a7bb200 100644
a
|
b
|
def __init__(self):
|
204 | 204 | self.on_alert_file_error) |
205 | 205 | self.alerts.register_handler("file_completed_alert", |
206 | 206 | self.on_alert_file_completed) |
| 207 | self.alerts.register_handler("performance_alert", |
| 208 | self.on_alert_performance) |
207 | 209 | |
208 | 210 | def start(self): |
209 | 211 | # Get the pluginmanager reference |
… |
… |
def on_alert_file_completed(self, alert):
|
1153 | 1155 | return |
1154 | 1156 | component.get("EventManager").emit( |
1155 | 1157 | TorrentFileCompletedEvent(torrent_id, alert.index)) |
| 1158 | |
| 1159 | def on_alert_performance(self, alert): |
| 1160 | log.debug("performance_alert: %s", alert.message()) |
| 1161 | try |
| 1162 | # if send buffer is too small, try doubling its size |
| 1163 | settings = component.get("Core").session.settings() |
| 1164 | # cap buffer at 5MiB |
| 1165 | if settings.send_buffer_watermark <= 2621440 |
| 1166 | log.debug("send_buffer_watermark set to %s..", |
| 1167 | 2 * settings.send_buffer_watermark) |
| 1168 | setattr(settings, "send_buffer_watermark", |
| 1169 | 2 * settings.send_buffer_watermark) |
| 1170 | self.session.set_settings(settings) |
| 1171 | |
| 1172 | except: |
| 1173 | return |