sta / websocket-sharp

A C# implementation of the WebSocket protocol client and server
http://sta.github.io/websocket-sharp
MIT License
5.72k stars 1.66k forks source link

HttpConnection - deadlock? #279

Open Slyb00ts opened 8 years ago

Slyb00ts commented 8 years ago

Hi,

ive got some problems with downloading multiple files on slow connection. For example my index.html got in debug 100 files(css and js) and in release 4 files(css and js), some files are over 2mb, even compressed. All browsers now are downloading in parallel files, so for example chrome (when my app is in release mode) is trying to download 3 files in parallel, all are over 2mb. On slow connection it takes some time to download 2mb (almoust always over 15 sec, on 3G with VPN). The problem is that browser is getting only like 40kb and than it hangs doing nothing. After 15k ms(your timeout) the "onTimeout" is rised and the connection is closed. So those 3 files get ERR_CONTENT_LENGTH_MISMATCH. Also it doesnt matter if im sending chunked or not. Maybe lock should be on smaller parts of code and timout should be on every chunk instead of whole response? Oh and the problem also in mainly on Linux, Windows is working better, but also sometimes it has such error.

Regards, Piotr Jarocki

sta commented 8 years ago

Hello there,

I added a fix to the HttpConnection class, but i am not sure if it is helpful for you.