Improve image loading in htmltextview.py (threaded?)
Would be good to have image loading threaded or the like. Now it has 2 issues:
-
if there is heavy downloading in the background - it fails to load images completely because of timeouts.
-
if you increase timeout so it least works okay(i don't care about DDOS-es, i just want it to work okay) like this:
diff -r f6f16e7e3737 src/htmltextview.py --- a/src/htmltextview.py Sat Oct 17 10:18:11 2009 +0200 +++ b/src/htmltextview.py Sat Oct 17 21:41:19 2009 +0300 @@ -486,7 +486,7 @@ mem = '' try: # Wait maximum 1s for connection - socket.setdefaulttimeout(1) + socket.setdefaulttimeout(5) try: f = urllib2.urlopen(attrs['src']) except Exception, ex: @@ -496,7 +496,7 @@ else: # Wait 0.1s between each byte try: - f.fp._sock.fp._sock.settimeout(0.5) + f.fp._sock.fp._sock.settimeout(5) except Exception: pass # Max image size = 2 MB (to try to prevent DoS)
then it freezes gajim for too long just to load images.