mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-23 11:07:57 +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 XMPPConnection connection;
|
||||||
private LinkedList queue;
|
private LinkedList queue;
|
||||||
private boolean done = false;
|
private boolean done = false;
|
||||||
|
private int packetsWritten = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new packet writer with the specified connection.
|
* 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
|
* Starts the packet writer thread and opens a connection to the server. The
|
||||||
* packet writer will continue writing packets until {@link #shutdown} or an
|
* packet writer will continue writing packets until {@link #shutdown} or an
|
||||||
|
@ -152,6 +162,8 @@ class PacketWriter {
|
||||||
while (!done) {
|
while (!done) {
|
||||||
Packet packet = nextPacket();
|
Packet packet = nextPacket();
|
||||||
writer.write(packet.toXML());
|
writer.write(packet.toXML());
|
||||||
|
// Increment the count of packets written.
|
||||||
|
packetsWritten++;
|
||||||
writer.flush();
|
writer.flush();
|
||||||
}
|
}
|
||||||
// Close the stream.
|
// Close the stream.
|
||||||
|
|
Loading…
Reference in a new issue