mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
parent
986d4345d8
commit
0de0bf2ca0
@ -268,6 +268,15 @@ opencomputers {
|
||||
# IN PARTICULAR, DO NOT REPORT ISSUES AFTER MESSING WITH THIS!
|
||||
maxTotalRam: 67108864
|
||||
}
|
||||
|
||||
# The maximum depth a machine will queue signals before dropping them
|
||||
# A machine state should be pulling signals via computer.pullSignal
|
||||
# As the machine receives signals they are queued for pulling, and
|
||||
# this maximum defines the max queue size. All signals recieved when
|
||||
# the queue is full are discarded. Note that clipboard text creates
|
||||
# a signal for each line of text. Thus client are limited to pasting
|
||||
# text of this many lines. The default (and minimum) is 256
|
||||
maxSignalQueueSize: 256
|
||||
}
|
||||
|
||||
# Robot related settings, what they may do and general balancing.
|
||||
|
@ -338,7 +338,6 @@ class Settings(val config: Config) {
|
||||
val maxScreenWidth = config.getInt("misc.maxScreenWidth") max 1
|
||||
val maxScreenHeight = config.getInt("misc.maxScreenHeight") max 1
|
||||
val inputUsername = config.getBoolean("misc.inputUsername")
|
||||
val maxClipboard = config.getInt("misc.maxClipboard") max 0
|
||||
val maxNetworkPacketSize = config.getInt("misc.maxNetworkPacketSize") max 0
|
||||
// Need at least 4 for nanomachine protocol. Because I can!
|
||||
val maxNetworkPacketParts = config.getInt("misc.maxNetworkPacketParts") max 4
|
||||
@ -465,6 +464,9 @@ class Settings(val config: Config) {
|
||||
|
||||
val registerLuaJArchitecture = config.getBoolean("debug.registerLuaJArchitecture")
|
||||
val disableLocaleChanging = config.getBoolean("debug.disableLocaleChanging")
|
||||
|
||||
// >= 1.7.4
|
||||
val maxSignalQueueSize: Int = (if (config.hasPath("computer.maxSignalQueueSize")) config.getInt("computer.maxSignalQueueSize") else 256) min 256
|
||||
}
|
||||
|
||||
object Settings {
|
||||
|
@ -102,6 +102,8 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
||||
|
||||
private var cost = Settings.get.computerCost * Settings.get.tickFrequency
|
||||
|
||||
private val maxSignalQueueSize = Settings.get.maxSignalQueueSize
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def onHostChanged(): Unit = {
|
||||
@ -311,7 +313,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
||||
state.synchronized(state.top match {
|
||||
case Machine.State.Stopped | Machine.State.Stopping => return false
|
||||
case _ => signals.synchronized {
|
||||
if (signals.size >= 256) return false
|
||||
if (signals.size >= maxSignalQueueSize) return false
|
||||
else if (args == null) {
|
||||
signals.enqueue(new Machine.Signal(name, Array.empty))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user