… | |
… | |
157 | draw_client_map (pl); |
157 | draw_client_map (pl); |
158 | |
158 | |
159 | if (update_look) |
159 | if (update_look) |
160 | esrv_draw_look (pl); |
160 | esrv_draw_look (pl); |
161 | |
161 | |
162 | if (askface.empty () && !partial_face_ofs) |
162 | if (ixface.empty () && !partial_face_ofs) |
163 | { |
163 | { |
164 | // regularly send a new face when queue is empty |
164 | // regularly send a new face when queue is empty |
165 | if (bg_scrub && !--bg_scrub && enable_bg_scrub) |
165 | if (bg_scrub && !--bg_scrub && enable_bg_scrub) |
166 | while (scrub_idx < faces.size () - 1) |
166 | while (scrub_idx < faces.size () - 1) |
167 | { |
167 | { |
… | |
… | |
185 | rate_avail = min (max_rate, rate_avail + max_rate); |
185 | rate_avail = min (max_rate, rate_avail + max_rate); |
186 | rate_avail -= ol; |
186 | rate_avail -= ol; |
187 | |
187 | |
188 | int avail = rate_avail; |
188 | int avail = rate_avail; |
189 | |
189 | |
190 | // if we can split images, transfer up to mss packets if possible |
190 | // if we can split images, transfer up to mss-sized packets if possible |
191 | // but never more 768 bytes more. |
191 | // but never 768 bytes more. |
192 | if (fxix) avail += min (768, mss - (ol % mss)); |
192 | if (fxix) avail += min (768, mss - (ol % mss)); |
193 | |
193 | |
194 | bg_scrub = BG_SCRUB_RATE; |
194 | bg_scrub = BG_SCRUB_RATE; |
195 | |
195 | |
196 | while (avail > 0) |
196 | while (avail > 0) |
197 | { |
197 | { |
198 | if (partial_face_ofs) |
198 | if (partial_face_ofs) |
199 | { |
199 | { |
200 | if (facedata *d = face_data (partial_face, faceset)) |
200 | if (facedata *d = face_data (partial_face, faceset)) |
201 | { |
201 | { |
202 | // 9 bytes is enough for fx_FFFOOO, 40 leaves some room |
202 | // 9 bytes is enough for fx_FFFOOO, 40 leaves some room for image data |
203 | int chunk = min (min (avail - 40, MAXSOCKBUF - 9), partial_face_ofs); |
203 | int chunk = min (min (avail - 40, MAXSOCKBUF - 9), partial_face_ofs); |
204 | |
204 | |
205 | if (chunk <= 0) |
205 | if (chunk <= 0) |
206 | break; |
206 | break; |
207 | |
207 | |
… | |
… | |
216 | send_packet (sl); |
216 | send_packet (sl); |
217 | } |
217 | } |
218 | else |
218 | else |
219 | partial_face_ofs = 0; |
219 | partial_face_ofs = 0; |
220 | } |
220 | } |
221 | else if (!askface.empty ()) |
221 | else if (!ixface.empty ()) |
222 | { |
222 | { |
223 | // use a lifo to send most recently requested images |
223 | // use a lifo to send most recently requested images |
224 | faceidx facenum = askface.back (); |
224 | faceidx facenum = ixface.back (); |
225 | askface.pop_back (); |
225 | ixface.pop_back (); |
226 | |
226 | |
227 | if (fxix) |
227 | if (fxix) |
228 | { |
228 | { |
229 | if (facedata *d = face_data (facenum, faceset)) |
229 | if (facedata *d = face_data (facenum, faceset)) |
230 | { |
230 | { |