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

Move duplicate sendPacket() code into XMPPConnection

This commit is contained in:
Florian Schmaus 2014-03-17 19:33:17 +01:00
parent c3f9ec4f94
commit 6197f6200f
5 changed files with 26 additions and 48 deletions

View file

@ -80,10 +80,6 @@ class PacketWriter {
*/
public void sendPacket(Packet packet) {
if (!done) {
// Invoke interceptors for the new packet that is about to be sent. Interceptors
// may modify the content of the packet.
connection.firePacketInterceptors(packet);
try {
queue.put(packet);
}
@ -94,10 +90,6 @@ class PacketWriter {
synchronized (queue) {
queue.notifyAll();
}
// Process packet writer listeners. Note that we're using the sending
// thread so it's expected that listeners are fast.
connection.firePacketSendingListeners(packet);
}
}

View file

@ -414,13 +414,7 @@ public class TCPConnection extends XMPPConnection {
wasAuthenticated = false;
}
public void sendPacket(Packet packet) {
if (!isConnected()) {
throw new IllegalStateException("Not connected to server.");
}
if (packet == null) {
throw new NullPointerException("Packet is null.");
}
void sendPacketInternal(Packet packet) {
packetWriter.sendPacket(packet);
}