mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 09:39:39 +02:00
File transfer upgrade, 1.5 and beautification.
Fixed fault tolerant negotiator. SMACK-128 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7616 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
93766ee788
commit
c95c8b7e3a
10 changed files with 629 additions and 453 deletions
|
@ -19,10 +19,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.filetransfer;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.*;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.filter.*;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
@ -115,12 +112,12 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
PacketCollector collector = connection
|
||||
.createPacketCollector(new PacketIDFilter(openIQ.getPacketID()));
|
||||
connection.sendPacket(openIQ);
|
||||
|
||||
IQ openResponse = (IQ) collector.nextResult();
|
||||
// We don't want to wait forever for the result
|
||||
IQ openResponse = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
||||
collector.cancel();
|
||||
|
||||
if (openResponse == null) {
|
||||
throw new XMPPException("No response from peer");
|
||||
throw new XMPPException("No response from peer on IBB open");
|
||||
}
|
||||
|
||||
IQ.Type type = openResponse.getType();
|
||||
|
@ -144,9 +141,6 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
public void cleanup() {
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
private class IBBOutputStream extends OutputStream {
|
||||
|
||||
protected byte[] buffer;
|
||||
|
@ -457,10 +451,8 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
|
||||
IBBExtensions.Data data = (IBBExtensions.Data) packet.
|
||||
getExtension(IBBExtensions.Data.ELEMENT_NAME, IBBExtensions.NAMESPACE);
|
||||
if (data == null) {
|
||||
return false;
|
||||
}
|
||||
return data.getSessionID() != null && data.getSessionID().equalsIgnoreCase(sessionID);
|
||||
return data != null && data.getSessionID() != null
|
||||
&& data.getSessionID().equalsIgnoreCase(sessionID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue