summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2016-01-27 16:36:15 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2016-01-28 12:25:43 (GMT)
commitceb4798aa0739ebd7177632c3f508babacb2f8d7 (patch)
tree7e5a2c1852261c8f0e4d8ed3262a32cced037378 /src/com/isode/stroke/filetransfer/IBBSendSession.java
parent93eb4ab62a08da883cab4a3743a3a86c198eb0b4 (diff)
downloadstroke-ceb4798aa0739ebd7177632c3f508babacb2f8d7.zip
stroke-ceb4798aa0739ebd7177632c3f508babacb2f8d7.tar.bz2
Changes to FileTransfer to be inline with current Swiften code
There has been some changes to the file transfer clases in Swiften since Tarun's patch was written. This patch updates the java classes to bring them in line with the swiften one. In details IBBSendSession - added code to clean up onResponse connection when not needed. In Swiften this was done by keeping reference to current session using boost bindings to remove binding. In java we have to keep a reference to the current onResponse connection and disconnect it when not neeeded. IncomingFileTransferManager - Remove redundant IQRouter field. LocalJingeTransportCandidateGenerator - Do not advertise link-local IPv6 addresses in FT candidates OutgoingSIFileTransfer - File deleted SOCKS5BytestreamProxiesManager and SOCKS5BytestreamProxyFinder - Search for all proxies instead of just one. Test-information: Ran make and make test to check everything built ok and that the unit tests still passed. Change-Id: I696444e5074fe20625243693a44c836306b3a41e
Diffstat (limited to 'src/com/isode/stroke/filetransfer/IBBSendSession.java')
-rw-r--r--src/com/isode/stroke/filetransfer/IBBSendSession.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/com/isode/stroke/filetransfer/IBBSendSession.java b/src/com/isode/stroke/filetransfer/IBBSendSession.java
index 5a812ff..bb44006 100644
--- a/src/com/isode/stroke/filetransfer/IBBSendSession.java
+++ b/src/com/isode/stroke/filetransfer/IBBSendSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2013 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -12,6 +12,7 @@
package com.isode.stroke.filetransfer;
import com.isode.stroke.signals.Signal1;
+import com.isode.stroke.signals.SignalConnection;
import com.isode.stroke.signals.Slot2;
import com.isode.stroke.signals.Slot;
import com.isode.stroke.jid.JID;
@@ -31,8 +32,9 @@ public class IBBSendSession {
private int sequenceNumber;
private boolean active;
private boolean waitingForData;
+ private SignalConnection currentRequestOnResponseConnection;
- public IBBSendSession(final String id, final JID from, final JID to, ReadBytestream bytestream, IQRouter router) {
+ public IBBSendSession(final String id, final JID from, final JID to, ReadBytestream bytestream, IQRouter router) {
this.id = id;
this.from = from;
this.to = to;
@@ -52,7 +54,7 @@ public class IBBSendSession {
public void start() {
IBBRequest request = IBBRequest.create(from, to, IBB.createIBBOpen(id, (int)(blockSize)), router);
- request.onResponse.connect(new Slot2<IBB, ErrorPayload>() {
+ currentRequestOnResponseConnection = request.onResponse.connect(new Slot2<IBB, ErrorPayload>() {
@Override
public void call(IBB b, ErrorPayload e) {
handleIBBResponse(b, e);
@@ -66,6 +68,10 @@ public class IBBSendSession {
if (active && router.isAvailable()) {
IBBRequest.create(from, to, IBB.createIBBClose(id), router).send();
}
+ if (currentRequestOnResponseConnection != null) {
+ currentRequestOnResponseConnection.disconnect();
+ currentRequestOnResponseConnection = null;
+ }
finish(null);
}
@@ -83,8 +89,11 @@ public class IBBSendSession {
public final Signal1<FileTransferError> onFinished = new Signal1<FileTransferError>();
public final Signal1<Integer> onBytesSent = new Signal1<Integer>();
-
- private void handleIBBResponse(IBB ibb, ErrorPayload error) {
+ private void handleIBBResponse(IBB ibb, ErrorPayload error) {
+ if (currentRequestOnResponseConnection != null) {
+ currentRequestOnResponseConnection.disconnect();
+ currentRequestOnResponseConnection = null;
+ }
if (error == null && active) {
if (!bytestream.isFinished()) {
sendMoreData();