Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 77e77be

Browse files
authored
Set 10 second timeout on JGit transport commands (#1230)
* GitOperation: set a 10 second connection timeout Signed-off-by: Harsh Shandilya <[email protected]> * Update changelog Signed-off-by: Harsh Shandilya <[email protected]>
1 parent 993b203 commit 77e77be

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
1515
- Icons in Autofill suggestions are no longer black on almost black in dark mode.
1616
- Decrypt screen would stay in memory infinitely, allowing passwords to be seen without re-auth
1717
- Git commits in the store would wrongly use the 'default' committer as opposed to the user's configured one
18+
- Connection attempts now use a reasonable 10 second timeout as opposed to the default of 30 seconds
1819

1920
### Changed
2021

app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt

+9
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) {
108108
(transport as? SshTransport)?.sshSessionFactory = sshSessionFactory
109109
credentialsProvider?.let { transport.credentialsProvider = it }
110110
}
111+
command.setTimeout(CONNECT_TIMEOUT)
111112
}
112113
}
113114

@@ -204,4 +205,12 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) {
204205
sshSessionFactory?.close()
205206
}
206207
}
208+
209+
companion object {
210+
211+
/**
212+
* Timeout in seconds before [TransportCommand] will abort a stalled IO operation.
213+
*/
214+
private const val CONNECT_TIMEOUT = 10
215+
}
207216
}

0 commit comments

Comments
 (0)