Commit 5ff5b5d3 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Movied registration logic when sending data over the connection to XMLWriter...

Movied registration logic when sending data over the connection to XMLWriter when using an XMLWriter.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1423 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4b055840
......@@ -79,7 +79,7 @@ public class SocketConnection implements Connection {
this.socket = socket;
writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), CHARSET));
this.deliverer = deliverer;
xmlSerializer = new XMLWriter(writer);
xmlSerializer = new XMLWriter(writer, socket);
}
public boolean validate() {
......@@ -209,7 +209,7 @@ public class SocketConnection implements Connection {
if (flashClient) {
writer.write('\0');
}
xmlSerializer.flush();
writer.flush();
}
catch (IOException e) {}
finally {
......@@ -248,8 +248,6 @@ public class SocketConnection implements Connection {
boolean errorDelivering = false;
synchronized (writer) {
try {
// Register that we started sending data on the connection
SocketSendingTracker.getInstance().socketStartedSending(socket);
xmlSerializer.write(packet.getElement());
if (flashClient) {
writer.write('\0');
......@@ -260,10 +258,6 @@ public class SocketConnection implements Connection {
Log.debug("Error delivering packet" + "\n" + this.toString(), e);
errorDelivering = true;
}
finally {
// Register that we finished sending data on the connection
SocketSendingTracker.getInstance().socketFinishedSending(socket);
}
}
if (errorDelivering) {
close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment