Skip to content

Commit d4d1985

Browse files
committed
Merge remote-tracking branch 'origin/master-MC1.7.10' into master-MC1.12
2 parents 7ccc11a + fad5ad2 commit d4d1985

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

src/main/resources/application.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,13 @@ opencomputers {
12591259
# string from the clipboard (Shift+Ins on a screen with a keyboard).
12601260
maxClipboard: 1024
12611261

1262+
# The TTL (Time-To-Live) upon creation of a network packet. When a packet
1263+
# passes through a Relay, its TTL is decremented. If a Relay receives a
1264+
# packet with a TTL of 0, the packet is dropped. Minimum value is 5.
1265+
# Note: increasing this value to large numbers may have an significant
1266+
# impact on performances.
1267+
initialNetworkPacketTTL: 5
1268+
12621269
# The maximum size of network packets to allow sending via network cards.
12631270
# This has *nothing to do* with real network traffic, it's just a limit
12641271
# for the network cards, mostly to reduce the chance of computer with a

src/main/scala/li/cil/oc/Settings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ class Settings(val config: Config) {
346346
val maxScreenWidth = config.getInt("misc.maxScreenWidth") max 1
347347
val maxScreenHeight = config.getInt("misc.maxScreenHeight") max 1
348348
val inputUsername = config.getBoolean("misc.inputUsername")
349+
val initialNetworkPacketTTL = config.getInt("misc.initialNetworkPacketTTL") max 5
349350
val maxNetworkPacketSize = config.getInt("misc.maxNetworkPacketSize") max 0
350351
// Need at least 4 for nanomachine protocol. Because I can!
351352
val maxNetworkPacketParts = config.getInt("misc.maxNetworkPacketParts") max 4

src/main/scala/li/cil/oc/server/machine/luac/LuaStateFactory.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package li.cil.oc.server.machine.luac
22

3+
import java.io.BufferedInputStream
34
import java.io.File
45
import java.io.FileInputStream
56
import java.io.FileOutputStream
@@ -242,8 +243,8 @@ abstract class LuaStateFactory {
242243
if (tmpLibFile.exists()) {
243244
var matching = true
244245
try {
245-
val inCurrent = libraryUrl.openStream()
246-
val inExisting = new FileInputStream(tmpLibFile)
246+
val inCurrent = new BufferedInputStream(libraryUrl.openStream())
247+
val inExisting = new BufferedInputStream(new FileInputStream(tmpLibFile))
247248
var inCurrentByte = 0
248249
var inExistingByte = 0
249250
do {

src/main/scala/li/cil/oc/server/network/Network.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ object Network extends api.detail.NetworkAPI {
702702

703703
// ----------------------------------------------------------------------- //
704704

705-
class Packet(var source: String, var destination: String, var port: Int, var data: Array[AnyRef], var ttl: Int = 5) extends api.network.Packet {
705+
class Packet(var source: String, var destination: String, var port: Int, var data: Array[AnyRef], var ttl: Int = Settings.get.initialNetworkPacketTTL) extends api.network.Packet {
706706
val size = Option(data).fold(0)(values => {
707707
if (values.length > Settings.get.maxNetworkPacketParts) {
708708
throw new IllegalArgumentException("packet has too many parts")

0 commit comments

Comments
 (0)