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.77 by root, Tue May 6 16:55:26 2008 UTC vs.
Revision 1.78 by root, Sat Dec 27 01:25:00 2008 UTC

182#if HAVE_TCP_INFO 182#if HAVE_TCP_INFO
183 // further restrict the available bandwidth by the excess bandwidth available 183 // further restrict the available bandwidth by the excess bandwidth available
184 max_send = min (max_send, (tcpi.tcpi_snd_cwnd - tcpi.tcpi_unacked + tcpi.tcpi_sacked) * mss); 184 max_send = min (max_send, (tcpi.tcpi_snd_cwnd - tcpi.tcpi_unacked + tcpi.tcpi_sacked) * mss);
185#endif 185#endif
186 186
187 // if we can split images, round to next-lowest mss 187 // round to next-lowest mss
188 if (fxix) max_send -= max_send % mss; 188 max_send -= max_send % mss;
189 189
190 if (ixface.empty ()) 190 if (ixface.empty ())
191 { 191 {
192 // regularly send a new face when queue is empty 192 // regularly send a new face when queue is empty
193 if (bg_scrub && !--bg_scrub && enable_bg_scrub) 193 if (bg_scrub && !--bg_scrub)
194 while (scrub_idx < faces.size () - 1) 194 while (scrub_idx < faces.size () - 1)
195 { 195 {
196 ++scrub_idx; 196 ++scrub_idx;
197 197
198 if (!faces_sent [scrub_idx]) 198 if (!faces_sent [scrub_idx])
220 220
221 ixsend &ix = ixface.back (); 221 ixsend &ix = ixface.back ();
222 222
223 if (facedata *d = face_data (ix.idx, faceset)) 223 if (facedata *d = face_data (ix.idx, faceset))
224 { 224 {
225 if (fxix)
226 {
227 // estimate the packet header overhead "ix " + idx + (new)ofs 225 // estimate the packet header overhead "ix " + idx + (new)ofs
228 int pktlen = 3 + ber32::encoded_size (ix.idx) + ber32::encoded_size (ix.ofs); 226 int pktlen = 3 + ber32::encoded_size (ix.idx) + ber32::encoded_size (ix.ofs);
229 int chunk = min (avail - packet::hdrlen, MAXSOCKBUF) - pktlen; 227 int chunk = min (avail - packet::hdrlen, MAXSOCKBUF) - pktlen;
230 228
231 // only transfer something if the amount of data transferred 229 // only transfer something if the amount of data transferred
232 // has a healthy relation to the header overhead 230 // has a healthy relation to the header overhead
233 if (chunk < 64) 231 if (chunk < 64)
234 break; 232 break;
235 233
236 chunk = min (chunk, (int)ix.ofs); 234 chunk = min (chunk, (int)ix.ofs);
237 235
238 ix.ofs -= chunk; 236 ix.ofs -= chunk;
239 237
240 //fprintf (stderr, "i%dx %6d: %5d+%4d (%4d)\n", fxix, ix.idx,ix.ofs,chunk, ixface.size());//D 238 //fprintf (stderr, "i%dx %6d: %5d+%4d (%4d)\n", fxix, ix.idx,ix.ofs,chunk, ixface.size());//D
241 239
242 packet sl ("ix"); 240 packet sl ("ix");
243 241
244 sl << ber32 (ix.idx) 242 sl << ber32 (ix.idx)
245 << ber32 (ix.ofs) 243 << ber32 (ix.ofs)
246 << data (d->data.data () + ix.ofs, chunk); 244 << data (d->data.data () + ix.ofs, chunk);
247 245
248 send_packet (sl); 246 send_packet (sl);
249 }
250 else
251 {
252 send_image (ix.idx);
253 ix.ofs = 0;
254 }
255 } 247 }
256 else 248 else
257 ix.ofs = 0; 249 ix.ofs = 0;
258 250
259 if (!ix.ofs) 251 if (!ix.ofs)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines