1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 09:09:38 +02:00

Add XMPPConnection.sendStanza(Stanza)

and deprecate sendPacket().
This commit is contained in:
Florian Schmaus 2015-03-04 21:44:43 +01:00
parent 183af99ffb
commit ed4fa3390f
58 changed files with 183 additions and 167 deletions

View file

@ -421,7 +421,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
// (Re-)send the stanzas *after* we tried to enable SM
for (Stanza stanza : previouslyUnackedStanzas) {
sendPacketInternal(stanza);
sendStanzaInternal(stanza);
}
afterSuccessfulLogin(false);
@ -508,7 +508,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
setWasAuthenticated();
// If we are able to resume the stream, then don't set
// connected/authenticated/usingTLS to false since we like behave like we are still
// connected (e.g. sendPacket should not throw a NotConnectedException).
// connected (e.g. sendStanza should not throw a NotConnectedException).
if (isSmResumptionPossible() && instant) {
disconnectedButResumeable = true;
} else {
@ -536,7 +536,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
@Override
protected void sendPacketInternal(Stanza packet) throws NotConnectedException {
protected void sendStanzaInternal(Stanza packet) throws NotConnectedException {
packetWriter.sendStreamElement(packet);
if (isSmEnabled()) {
for (StanzaFilter requestAckPredicate : requestAckPredicates) {
@ -1342,8 +1342,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
unacknowledgedStanzas = new ArrayBlockingQueue<>(QUEUE_SIZE);
}
// Check if the stream element should be put to the unacknowledgedStanza
// queue. Note that we can not do the put() in sendPacketInternal() and the
// packet order is not stable at this point (sendPacketInternal() can be
// queue. Note that we can not do the put() in sendStanzaInternal() and the
// packet order is not stable at this point (sendStanzaInternal() can be
// called concurrently).
if (unacknowledgedStanzas != null && packet != null) {
// If the unacknowledgedStanza queue is nearly full, request an new ack

View file

@ -35,7 +35,7 @@ public class PacketWriterTest {
/**
* Make sure that packet writer does block once the queue reaches
* {@link PacketWriter#QUEUE_SIZE} and that
* {@link PacketWriter#sendPacket(org.jivesoftware.smack.tcp.packet.Packet)} does unblock after the
* {@link PacketWriter#sendStanza(org.jivesoftware.smack.tcp.packet.Packet)} does unblock after the
* interrupt.
*
* @throws InterruptedException
@ -84,7 +84,7 @@ public class PacketWriterTest {
// will block before we call shutdown. Otherwise we may get false positives (which is still
// better then false negatives).
barrier.await();
// Not really cool, but may increases the chances for 't' to block in sendPacket.
// Not really cool, but may increases the chances for 't' to block in sendStanza.
Thread.sleep(250);
// Set to true for testing purposes, so that shutdown() won't wait packet writer