Reset the framing output stream before we write the message rather than after
in case we freak out in the middle of writing a message. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4645 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -724,8 +724,10 @@ public class ConnectionManager extends LoopingThread
|
||||
Thread.dumpStack();
|
||||
|
||||
} else {
|
||||
// flatten this message using the connection's output stream
|
||||
try {
|
||||
_framer.resetFrame();
|
||||
|
||||
// flatten this message using the connection's output stream
|
||||
ObjectOutputStream oout = conn.getObjectOutputStream(_framer);
|
||||
oout.writeObject(msg);
|
||||
oout.flush();
|
||||
@@ -734,10 +736,8 @@ public class ConnectionManager extends LoopingThread
|
||||
ByteBuffer buffer = _framer.frameAndReturnBuffer();
|
||||
byte[] data = new byte[buffer.limit()];
|
||||
buffer.get(data);
|
||||
_framer.resetFrame();
|
||||
|
||||
// Log.info("Flattened " + msg + " into " +
|
||||
// data.length + " bytes.");
|
||||
// Log.info("Flattened " + msg + " into " + data.length + " bytes.");
|
||||
|
||||
// and slap both on the queue
|
||||
_outq.append(new Tuple<Connection,byte[]>(conn, data));
|
||||
|
||||
Reference in New Issue
Block a user