Skip to content

Commit

Permalink
Improve HttpClient cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamlooker committed Sep 26, 2023
1 parent a6795c8 commit 7c4db3c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ import java.net.Proxy
internal class KtorDownloader : Downloader {

private var client = HttpClient(OkHttp) { timeoutConfig() }
set(newClient) {
field.close()
field = newClient
}

override fun setProxy(proxy: Proxy) {
client.close()
client = HttpClient(OkHttp) {
timeoutConfig()
engine { this.proxy = proxy }
Expand Down

0 comments on commit 7c4db3c

Please sign in to comment.