mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Move duplicate sendPacket() code into XMPPConnection
This commit is contained in:
parent
c3f9ec4f94
commit
6197f6200f
5 changed files with 26 additions and 48 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue