1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-06-30 15:26:46 +02:00

Keeps track of the number of packets written.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2153 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-10-21 17:39:18 +00:00 committed by mtucker
parent 88eb8090e6
commit 8688966ca6

View file

@ -69,6 +69,7 @@ class PacketWriter {
private XMPPConnection connection;
private LinkedList queue;
private boolean done = false;
private int packetsWritten = 0;
/**
* Creates a new packet writer with the specified connection.
@ -103,6 +104,15 @@ class PacketWriter {
}
}
/**
* Returns the number of packets written through this packet writer.
*
* @return the number of packets written.
*/
public int getPacketsWritten() {
return packetsWritten;
}
/**
* Starts the packet writer thread and opens a connection to the server. The
* packet writer will continue writing packets until {@link #shutdown} or an
@ -152,6 +162,8 @@ class PacketWriter {
while (!done) {
Packet packet = nextPacket();
writer.write(packet.toXML());
// Increment the count of packets written.
packetsWritten++;
writer.flush();
}
// Close the stream.