Skip to content

Commit f2b4d22

Browse files
committed
Adjust File transfer buffer size.
1 parent 9aacdc3 commit f2b4d22

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ android {
3838
multiDexEnabled true
3939
minifyEnabled false
4040
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
41+
signingConfig signingConfigs.debug
4142
}
4243
}
4344
compileOptions {

app/src/main/java/com/tans/tfiletransporter/net/filetransporter/MultiConnectionsFileTransfer.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import java.util.concurrent.atomic.AtomicInteger
2626
import java.util.concurrent.atomic.AtomicLong
2727
import kotlin.math.max
2828

29-
// 1.5 MB
30-
private const val MULTI_CONNECTIONS_BUFFER_SIZE: Int = 1024 * 1024 + 1024 * 512
29+
// 512KB
30+
private const val MULTI_CONNECTIONS_BUFFER_SIZE: Int = 1024 * 512
3131
private const val MULTI_CONNECTIONS_MAX: Int = 30
3232
// 10 MB
3333
private const val MULTI_CONNECTIONS_MIN_FRAME_SIZE: Long = 1024 * 1024 * 10
@@ -272,6 +272,7 @@ class MultiConnectionsFileTransferClient(
272272
sc.use {
273273
sc.setOptionSuspend(StandardSocketOptions.SO_REUSEADDR, true)
274274
sc.setOptionSuspend(StandardSocketOptions.TCP_NODELAY, true)
275+
sc.setOptionSuspend(StandardSocketOptions.SO_KEEPALIVE, true)
275276
sc.connectSuspend(InetSocketAddress(serverAddress, MULTI_CONNECTIONS_FILES_TRANSFER_LISTEN_PORT))
276277
sc.writeSuspendSize(buffer, md5)
277278
sc.writeSuspendSize(buffer, start.toBytes())

0 commit comments

Comments
 (0)