ConnectionManager can be configured to allow larger messages.
Messages that are too big are dropped and the clients have no hope of recovering. Warnings are logged but that's it. Allow bigger.
This commit is contained in:
@@ -66,6 +66,16 @@ public abstract class ConnectionManager extends LoopingThread
|
|||||||
_onExit = onExit;
|
_onExit = onExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the largest number of bytes we'll send in a message.
|
||||||
|
* Messages larger than this will log, refuse to send, and then things go badly for that client.
|
||||||
|
* We don't presently handle this well, we may as well disconnect the player at that point.
|
||||||
|
*/
|
||||||
|
public void setMaximumMessageSize (int maximumMessageSize)
|
||||||
|
{
|
||||||
|
_maxMsgSize = maximumMessageSize;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns our current runtime statistics. <em>Note:</em> don't call this method <em>too</em>
|
* Returns our current runtime statistics. <em>Note:</em> don't call this method <em>too</em>
|
||||||
* frequently as it is synchronized and will contend with the network I/O thread.
|
* frequently as it is synchronized and will contend with the network I/O thread.
|
||||||
@@ -339,7 +349,7 @@ public abstract class ConnectionManager extends LoopingThread
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sanity check the message size
|
// sanity check the message size
|
||||||
if (data.length > 1024 * 1024) {
|
if (data.length > _maxMsgSize) {
|
||||||
log.warning("Refusing to write very large message", "conn", conn, "size", data.length);
|
log.warning("Refusing to write very large message", "conn", conn, "size", data.length);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -606,6 +616,9 @@ public abstract class ConnectionManager extends LoopingThread
|
|||||||
/** Our current runtime stats. */
|
/** Our current runtime stats. */
|
||||||
protected ConMgrStats _stats = new ConMgrStats();
|
protected ConMgrStats _stats = new ConMgrStats();
|
||||||
|
|
||||||
|
/** The maximum message size we'll send. */
|
||||||
|
protected int _maxMsgSize = 1024 * 1024;
|
||||||
|
|
||||||
/** Used to periodically report connection manager activity when in debug mode. */
|
/** Used to periodically report connection manager activity when in debug mode. */
|
||||||
protected long _lastDebugStamp;
|
protected long _lastDebugStamp;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user