mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2024-11-26 23:50:32 +00:00
Improve address candidate prioritization order
This commit is contained in:
parent
e249dff7eb
commit
9387e34a77
@ -125,15 +125,19 @@ public class AddressCandidateHelper(
|
||||
// Score based on protocol
|
||||
when (protocol) {
|
||||
URLProtocol.HTTPS -> score += 5
|
||||
else -> score -= 5
|
||||
else -> score -= 5 // HTTP is less secure, try a secure option first
|
||||
}
|
||||
|
||||
// Score based on port
|
||||
when (port) {
|
||||
JF_HTTP_PORT -> score += 2
|
||||
80 -> score += 1
|
||||
JF_HTTPS_PORT -> score -= 1 // Using the Jellyfin HTTPS port is not common
|
||||
}
|
||||
|
||||
// Prefer default port for used protocol
|
||||
if (protocol == URLProtocol.HTTPS && port == 443) score += 3
|
||||
if (protocol == URLProtocol.HTTP && port == 80) score += 3
|
||||
|
||||
return score
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user