mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01: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:
parent
88eb8090e6
commit
8688966ca6
1 changed files with 12 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue