--- deliantra/server/socket/loop.C 2007/07/01 05:47:00 1.56 +++ deliantra/server/socket/loop.C 2007/07/24 04:55:35 1.61 @@ -168,7 +168,7 @@ if (!faces_sent [scrub_idx]) { - send_face (scrub_idx); + send_face (scrub_idx, -120); flush_fx (); bg_scrub = 1; // send up to one face per tick, unless an image was requested @@ -178,7 +178,7 @@ rate_avail = max_rate - outputbuffer_len (); } - else + else if (!outq) // only send when bandwidth allows it { int ol = outputbuffer_len (); @@ -201,14 +201,21 @@ { 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; ix.ofs -= chunk; + //fprintf (stderr, "i%dx %6d: %5d+%4d (%4d)\n", fxix, ix.idx,ix.ofs,chunk, ixface.size());//D + packet sl ("ix"); sl << ber32 (ix.idx)