--- deliantra/server/socket/loop.C 2007/07/01 05:00:20 1.55 +++ deliantra/server/socket/loop.C 2007/07/05 10:34:08 1.58 @@ -201,8 +201,13 @@ { if (fxix) { - // 9 bytes is enough for fx_FFFOOO, 40 leaves some room for image data - int chunk = min (min (avail - 40, MAXSOCKBUF - 9), ix.ofs); + // only transfer something if the amount of data transferred + // has a healthy relation to the header overhead + if (avail <= 40) + break; + + // 9 bytes is enough for fx_FFFOOO + int chunk = min (min (avail, MAXSOCKBUF - 9), (int)ix.ofs); if (chunk <= 0) break; @@ -226,7 +231,7 @@ else ix.ofs = 0; - int consumed = ol - outputbuffer_len (); + int consumed = outputbuffer_len () - ol; avail -= consumed; rate_avail -= consumed; @@ -236,6 +241,7 @@ if (!ix.ofs) { ixface.pop_back (); + if (ixface.empty ()) break; }