stingle/stingle-photos-android

App doesn't use HTTP keep-alive

Opened this issue · 2 comments

The android app creates a new TCP connection for every request to the server. By default, HttpsURLConnection enables HTTP keep-alive, but something in the app's code makes it so that the TCP connections cannot be reused.

This means that every HTTPS request requires a TLS handshake, and the underlying TCP connection stays open until the keep-alive timeout is reached.

A quick google search on java HttpsURLConnection not using http keep-alive seems to indicate that the problem might be:

https://github.com/stingle/stingle-photos-android/blob/master/StinglePhotos/src/main/java/org/stingle/photos/Net/HttpsClient.java#L82

			conn.setSSLSocketFactory(sc.getSocketFactory());

The return value of sc.getSocketFactory() would need to be reused between requests

Thanks for the report

I use a private DNS server on my phone (dnsforge.de), and when I enable it, I sometimes have issues when uploading several (larger) files at once. (The upload requests fail)
rthellend gave me the tipp that this might be related to this issue, as there might be the possibility that each request does its own dns lookup and therefore might trigger a ratelimit or something alike.