Changeset 08042bd in mainline


Ignore:
Timestamp:
2010-11-05T16:34:52Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
376a7fd
Parents:
60898b6
Message:

Do not drop the packet if the user can provide larger buffer next time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/udp/udp.c

    r60898b6 r08042bd  
    626626
    627627        // get the next received packet
    628         packet_id = dyn_fifo_pop(&socket->received);
     628        packet_id = dyn_fifo_value(&socket->received);
    629629        if (packet_id < 0)
    630630                return NO_DATA;
    631631       
    632632        rc = packet_translate_remote(udp_globals.net_phone, &packet, packet_id);
    633         if (rc != EOK)
     633        if (rc != EOK) {
     634                (void) dyn_fifo_pop(&socket->received);
    634635                return rc;
     636        }
    635637
    636638        // get udp header
    637639        data = packet_get_data(packet);
    638         if (!data)
     640        if (!data) {
     641                (void) dyn_fifo_pop(&socket->received);
    639642                return udp_release_and_return(packet, NO_DATA);
     643        }
    640644        header = (udp_header_ref) data;
    641645
     
    643647        result = packet_get_addr(packet, (uint8_t **) &addr, NULL);
    644648        rc = tl_set_address_port(addr, result, ntohs(header->source_port));
    645         if (rc != EOK)
     649        if (rc != EOK) {
     650                (void) dyn_fifo_pop(&socket->received);
    646651                return udp_release_and_return(packet, rc);
     652        }
    647653        *addrlen = (size_t) result;
    648654
    649655        // send the source address
    650656        rc = data_reply(addr, *addrlen);
    651         if (rc != EOK)
     657        switch (rc) {
     658        case EOK:
     659                break;
     660        case EOVERFLOW:
     661                return rc;
     662        default:
     663                (void) dyn_fifo_pop(&socket->received);
    652664                return udp_release_and_return(packet, rc);
     665        }
    653666
    654667        // trim the header
    655668        rc = packet_trim(packet, UDP_HEADER_SIZE, 0);
    656         if (rc != EOK)
     669        if (rc != EOK) {
     670                (void) dyn_fifo_pop(&socket->received);
    657671                return udp_release_and_return(packet, rc);
     672        }
    658673
    659674        // reply the packets
    660675        rc = socket_reply_packets(packet, &length);
    661         if (rc != EOK)
     676        switch (rc) {
     677        case EOK:
     678                break;
     679        case EOVERFLOW:
     680                return rc;
     681        default:
     682                (void) dyn_fifo_pop(&socket->received);
    662683                return udp_release_and_return(packet, rc);
     684        }
     685
     686        (void) dyn_fifo_pop(&socket->received);
    663687
    664688        // release the packet and return the total length
Note: See TracChangeset for help on using the changeset viewer.