request stanza count after every ibb data stanza to not fill our own stanza queue

This commit is contained in:
Daniel Gultsch 2015-09-30 23:42:02 +02:00
parent 648e29db2c
commit 9dcf074a79
2 changed files with 9 additions and 6 deletions

View File

@ -957,7 +957,6 @@ public class XmppConnection implements Runnable {
disconnect(true); disconnect(true);
return; return;
} }
final String name = packet.getName();
tagWriter.writeStanzaAsync(packet); tagWriter.writeStanzaAsync(packet);
if (packet instanceof AbstractAcknowledgeableStanza) { if (packet instanceof AbstractAcknowledgeableStanza) {
AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet; AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet;
@ -973,9 +972,7 @@ public class XmppConnection implements Runnable {
} }
public void sendPing() { public void sendPing() {
if (streamFeatures.hasChild("sm")) { if (!r()) {
tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
} else {
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET); final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
iq.setFrom(account.getJid()); iq.setFrom(account.getJid());
iq.addChild("ping", "urn:xmpp:ping"); iq.addChild("ping", "urn:xmpp:ping");
@ -1086,8 +1083,13 @@ public class XmppConnection implements Runnable {
return null; return null;
} }
public void r() { public boolean r() {
this.tagWriter.writeStanzaAsync(new RequestPacket(smVersion)); if (getFeatures().sm()) {
this.tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
return true;
} else {
return false;
}
} }
public String getMucServer() { public String getMucServer() {

View File

@ -176,6 +176,7 @@ public class JingleInbandTransport extends JingleTransport {
data.setAttribute("sid", this.sessionId); data.setAttribute("sid", this.sessionId);
data.setContent(base64); data.setContent(base64);
this.account.getXmppConnection().sendIqPacket(iq, this.onAckReceived); this.account.getXmppConnection().sendIqPacket(iq, this.onAckReceived);
this.account.getXmppConnection().r(); //don't fill up stanza queue too much
this.seq++; this.seq++;
if (this.remainingSize > 0) { if (this.remainingSize > 0) {
connection.updateProgress((int) ((((double) (this.fileSize - this.remainingSize)) / this.fileSize) * 100)); connection.updateProgress((int) ((((double) (this.fileSize - this.remainingSize)) / this.fileSize) * 100));