--- deliantra/server/socket/loop.C 2007/07/28 00:15:03 1.63 +++ deliantra/server/socket/loop.C 2007/07/28 00:45:05 1.64 @@ -158,48 +158,50 @@ if (update_look) esrv_draw_look (pl); - if (ixface.empty ()) + bool overload = false; + +#if HAVE_TCP_INFO + // do bandwidth checking + if (tcpi.tcpi_unacked + 1 > max (4, tcpi.tcpi_snd_cwnd)) { - // regularly send a new face when queue is empty - if (bg_scrub && !--bg_scrub && enable_bg_scrub) - while (scrub_idx < faces.size () - 1) - { - ++scrub_idx; + overload = true; + if (next_rate_adjust <= NOW) + { + next_rate_adjust = NOW + 2; + max_rate = max (max_rate >> 1, int (5000 * TICK)); + LOG (llevDebug, "tcp %s overloaded (%d + 1 > 4 | %d), rate now %d\n", + host, (int)tcpi.tcpi_unacked, (int)tcpi.tcpi_snd_cwnd, int (max_rate / TICK));//D + send_packet_printf ("drawinfo %d Due to possible network congestion, your output-rate has been reduced to %dbps.", + NDI_RED, int (max_rate / TICK)); + } + } +#endif - if (!faces_sent [scrub_idx]) + if (!overload) + { + if (ixface.empty ()) + { + // regularly send a new face when queue is empty + if (bg_scrub && !--bg_scrub && enable_bg_scrub) + while (scrub_idx < faces.size () - 1) { - send_face (scrub_idx, -120); - flush_fx (); + ++scrub_idx; - bg_scrub = 1; // send up to one face per tick, unless an image was requested - break; + if (!faces_sent [scrub_idx]) + if (faceinfo *f = face_info (scrub_idx)) + if (f->type == FT_FACE) // only scrub faces for now + { + send_face (scrub_idx, -120); + flush_fx (); + + bg_scrub = 1; // send up to one face per tick, unless an image was requested + break; + } } - } - rate_avail = max_rate - outputbuffer_len (); - } - else - { - bool overload = false; - -#if HAVE_TCP_INFO - // do bandwidth checking - if (tcpi.tcpi_unacked + 1 > max (4, tcpi.tcpi_snd_cwnd)) - { - overload = true; - if (next_rate_adjust <= NOW) - { - next_rate_adjust = NOW + 2; - max_rate = max (max_rate >> 1, int (5000 * TICK)); - LOG (llevDebug, "tcp %s overloaded (%d + 1 > 4 | %d), rate now %d\n", - host, (int)tcpi.tcpi_unacked, (int)tcpi.tcpi_snd_cwnd, int (max_rate / TICK));//D - send_packet_printf ("drawinfo %d Due to possible network congestion, your output-rate has been reduced to %dbps.", - NDI_RED, int (max_rate / TICK)); - } + rate_avail = max_rate - outputbuffer_len (); } -#endif - - if (!overload) + else { int ol = outputbuffer_len ();