ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/loop.C
(Generate patch)

Comparing deliantra/server/socket/loop.C (file contents):
Revision 1.63 by root, Sat Jul 28 00:15:03 2007 UTC vs.
Revision 1.64 by root, Sat Jul 28 00:45:05 2007 UTC

156 draw_client_map (pl); 156 draw_client_map (pl);
157 157
158 if (update_look) 158 if (update_look)
159 esrv_draw_look (pl); 159 esrv_draw_look (pl);
160 160
161 bool overload = false;
162
163#if HAVE_TCP_INFO
164 // do bandwidth checking
165 if (tcpi.tcpi_unacked + 1 > max (4, tcpi.tcpi_snd_cwnd))
166 {
167 overload = true;
168 if (next_rate_adjust <= NOW)
169 {
170 next_rate_adjust = NOW + 2;
171 max_rate = max (max_rate >> 1, int (5000 * TICK));
172 LOG (llevDebug, "tcp %s overloaded (%d + 1 > 4 | %d), rate now %d\n",
173 host, (int)tcpi.tcpi_unacked, (int)tcpi.tcpi_snd_cwnd, int (max_rate / TICK));//D
174 send_packet_printf ("drawinfo %d Due to possible network congestion, your output-rate has been reduced to %dbps.",
175 NDI_RED, int (max_rate / TICK));
176 }
177 }
178#endif
179
180 if (!overload)
181 {
161 if (ixface.empty ()) 182 if (ixface.empty ())
162 { 183 {
163 // regularly send a new face when queue is empty 184 // regularly send a new face when queue is empty
164 if (bg_scrub && !--bg_scrub && enable_bg_scrub) 185 if (bg_scrub && !--bg_scrub && enable_bg_scrub)
165 while (scrub_idx < faces.size () - 1) 186 while (scrub_idx < faces.size () - 1)
166 {
167 ++scrub_idx;
168
169 if (!faces_sent [scrub_idx])
170 { 187 {
188 ++scrub_idx;
189
190 if (!faces_sent [scrub_idx])
191 if (faceinfo *f = face_info (scrub_idx))
192 if (f->type == FT_FACE) // only scrub faces for now
193 {
171 send_face (scrub_idx, -120); 194 send_face (scrub_idx, -120);
172 flush_fx (); 195 flush_fx ();
173 196
174 bg_scrub = 1; // send up to one face per tick, unless an image was requested 197 bg_scrub = 1; // send up to one face per tick, unless an image was requested
175 break; 198 break;
199 }
176 } 200 }
177 }
178 201
179 rate_avail = max_rate - outputbuffer_len (); 202 rate_avail = max_rate - outputbuffer_len ();
180 }
181 else
182 {
183 bool overload = false;
184
185#if HAVE_TCP_INFO
186 // do bandwidth checking
187 if (tcpi.tcpi_unacked + 1 > max (4, tcpi.tcpi_snd_cwnd))
188 { 203 }
189 overload = true; 204 else
190 if (next_rate_adjust <= NOW)
191 {
192 next_rate_adjust = NOW + 2;
193 max_rate = max (max_rate >> 1, int (5000 * TICK));
194 LOG (llevDebug, "tcp %s overloaded (%d + 1 > 4 | %d), rate now %d\n",
195 host, (int)tcpi.tcpi_unacked, (int)tcpi.tcpi_snd_cwnd, int (max_rate / TICK));//D
196 send_packet_printf ("drawinfo %d Due to possible network congestion, your output-rate has been reduced to %dbps.",
197 NDI_RED, int (max_rate / TICK));
198 }
199 }
200#endif
201
202 if (!overload)
203 { 205 {
204 int ol = outputbuffer_len (); 206 int ol = outputbuffer_len ();
205 207
206 rate_avail = min (max_rate, rate_avail + max_rate); 208 rate_avail = min (max_rate, rate_avail + max_rate);
207 rate_avail -= ol; 209 rate_avail -= ol;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines