Browse Source

Ensure we never set the rTorrent XML-RPC size limit to some way too small value; use a minimum of 2MB for now. Fixes #221.

pull/256/head
Eric Kok 9 years ago
parent
commit
9b3bff2ea0
  1. 5
      app/src/main/java/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

5
app/src/main/java/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

@ -78,6 +78,8 @@ public class RtorrentAdapter implements IDaemonAdapter { @@ -78,6 +78,8 @@ public class RtorrentAdapter implements IDaemonAdapter {
private static final String LOG_NAME = "rTorrent daemon";
private static final String DEFAULT_RPC_URL = "/RPC2";
private static final int XMLRPC_MINIMUM_SIZE = 2 * 1024 * 1024;
private static final int XMLRPC_EXTRA_PADDING = 1280;
private DaemonSettings settings;
private XMLRPCClient rpcclient;
@ -176,8 +178,7 @@ public class RtorrentAdapter implements IDaemonAdapter { @@ -176,8 +178,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
baos.write(buffer, 0, read);
}
byte[] bytes = baos.toByteArray();
int size = (int) file.length() * 2;
final int XMLRPC_EXTRA_PADDING = 1280;
int size = Math.max(((int) file.length() * 2) + XMLRPC_EXTRA_PADDING, XMLRPC_MINIMUM_SIZE);
if (version >= 907) {
makeRtorrentCall(log, "network.xmlrpc.size_limit.set", new Object[]{size + XMLRPC_EXTRA_PADDING});
makeRtorrentCall(log, "load.raw_start", new Object[]{bytes});

Loading…
Cancel
Save