summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-12-03 16:52:22 +0530
committerGitHub <noreply@github.com>2020-12-03 12:22:22 +0100
commit77e77be999ed45dfccf1c3db838821442931eff4 (patch)
tree0ee6b5f63d437d16d1ad008b64ed287819079c9a /app/src/main/java
parent993b2036765dfcabf7fb5cf8679a6f1479cab7f3 (diff)
Set 10 second timeout on JGit transport commands (#1230)openpgp-ktx-v2.2.0autofill-parser-v1.0.0
* GitOperation: set a 10 second connection timeout Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Update changelog Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt
index 491feaf0..5649e8de 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt
@@ -108,6 +108,7 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) {
(transport as? SshTransport)?.sshSessionFactory = sshSessionFactory
credentialsProvider?.let { transport.credentialsProvider = it }
}
+ command.setTimeout(CONNECT_TIMEOUT)
}
}
@@ -204,4 +205,12 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) {
sshSessionFactory?.close()
}
}
+
+ companion object {
+
+ /**
+ * Timeout in seconds before [TransportCommand] will abort a stalled IO operation.
+ */
+ private const val CONNECT_TIMEOUT = 10
+ }
}