~bremby/grub4helenos/main

« back to all changes in this revision

Viewing changes to uspace/srv/net/inetsrv/reass.c

  • Committer: Dominik Taborsky
  • Date: 2013-11-21 18:22:43 UTC
  • mfrom: (1709.15.116 main-clone)
  • Revision ID: dominik_taborsky_brembyatseznamdotcz-20131121182243-hj3h7k9oscpbxilu
mainlineĀ merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
{
129
129
        assert(fibril_mutex_is_locked(&reass_dgram_map_lock));
130
130
 
131
 
        list_foreach(reass_dgram_map, link) {
132
 
                reass_dgram_t *rdg = list_get_instance(link, reass_dgram_t,
133
 
                    map_link);
134
 
 
 
131
        list_foreach(reass_dgram_map, map_link, reass_dgram_t, rdg) {
135
132
                link_t *f1_link = list_first(&rdg->frags);
136
133
                assert(f1_link != NULL);
137
134
 
288
285
        size_t dgram_size;
289
286
        size_t fragoff_limit;
290
287
        inet_dgram_t dgram;
291
 
        reass_frag_t *frag;
292
288
        uint8_t proto;
 
289
        reass_frag_t *frag;
293
290
 
294
291
        /*
295
292
         * Potentially there could be something beyond the first packet
296
293
         * that has !MF. Make sure we ignore that.
297
294
         */
298
295
        frag = NULL;
299
 
        list_foreach(rdg->frags, link) {
300
 
                frag = list_get_instance(link, reass_frag_t, dgram_link);
301
 
 
302
 
                if (!frag->packet.mf)
 
296
        list_foreach(rdg->frags, dgram_link, reass_frag_t, cfrag) {
 
297
                if (!cfrag->packet.mf) {
 
298
                        frag = cfrag;
303
299
                        break;
 
300
                }
304
301
        }
305
302
 
306
303
        assert(frag != NULL);
329
326
 
330
327
        size_t doffs = 0;
331
328
 
332
 
        frag = NULL;
333
 
        list_foreach(rdg->frags, link) {
334
 
                frag = list_get_instance(link, reass_frag_t, dgram_link);
335
 
 
 
329
        list_foreach(rdg->frags, dgram_link, reass_frag_t, cfrag) {
336
330
                size_t cb, ce;
337
331
 
338
 
                cb = max(doffs, frag->packet.offs);
339
 
                ce = min(dgram_size, frag->packet.offs + frag->packet.size);
 
332
                cb = max(doffs, cfrag->packet.offs);
 
333
                ce = min(dgram_size, cfrag->packet.offs + cfrag->packet.size);
340
334
 
341
335
                if (ce > cb) {
342
336
                        memcpy(dgram.data + cb,
343
 
                            frag->packet.data + cb - frag->packet.offs,
 
337
                            cfrag->packet.data + cb - cfrag->packet.offs,
344
338
                            ce - cb);
345
339
                }
346
340
 
347
 
                if (!frag->packet.mf)
 
341
                if (!cfrag->packet.mf)
348
342
                        break;
349
343
        }
350
344