Changeset 694ca93f in mainline for uspace/srv/net/tl/udp/udp.c


Ignore:
Timestamp:
2011-05-01T19:34:26Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0e26444
Parents:
1ff896e (diff), 042fbe0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r1ff896e r694ca93f  
    417417        rc = packet_dimensions_initialize(&udp_globals.dimensions);
    418418        if (rc != EOK) {
    419                 socket_ports_destroy(&udp_globals.sockets);
     419                socket_ports_destroy(&udp_globals.sockets, free);
    420420                fibril_rwlock_write_unlock(&udp_globals.lock);
    421421                return rc;
     
    434434            &data);
    435435        if (rc != EOK) {
    436                 socket_ports_destroy(&udp_globals.sockets);
     436                socket_ports_destroy(&udp_globals.sockets, free);
    437437                fibril_rwlock_write_unlock(&udp_globals.lock);
    438438                return rc;
     
    499499        device_id_t device_id;
    500500        packet_dimension_t *packet_dimension;
     501        size_t size;
    501502        int rc;
     503
     504        /* In case of error, do not update the data fragment size. */
     505        *data_fragment_size = 0;
    502506       
    503507        rc = tl_get_address_port(addr, addrlen, &dest_port);
     
    539543                packet_dimension = &udp_globals.packet_dimension;
    540544//      }
     545
     546        /*
     547         * Update the data fragment size based on what the lower layers can
     548         * handle without fragmentation, but not more than the maximum allowed
     549         * for UDP.
     550         */
     551        size = MAX_UDP_FRAGMENT_SIZE;
     552        if (packet_dimension->content < size)
     553            size = packet_dimension->content;
     554        *data_fragment_size = size;
    541555
    542556        /* Read the first packet fragment */
     
    740754        int socket_id;
    741755        size_t addrlen;
    742         size_t size = 0;
     756        size_t size;
    743757        ipc_call_t answer;
    744758        size_t answer_count;
     
    786800                                break;
    787801                       
     802                        size = MAX_UDP_FRAGMENT_SIZE;
    788803                        if (tl_get_ip_packet_dimension(udp_globals.ip_phone,
    789804                            &udp_globals.dimensions, DEVICE_INVALID_ID,
    790805                            &packet_dimension) == EOK) {
    791                                 SOCKET_SET_DATA_FRAGMENT_SIZE(answer,
    792                                     packet_dimension->content);
     806                                if (packet_dimension->content < size)
     807                                        size = packet_dimension->content;
    793808                        }
    794 
    795 //                      SOCKET_SET_DATA_FRAGMENT_SIZE(answer,
    796 //                          MAX_UDP_FRAGMENT_SIZE);
     809                        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size);
    797810                        SOCKET_SET_HEADER_SIZE(answer, UDP_HEADER_SIZE);
    798811                        answer_count = 3;
Note: See TracChangeset for help on using the changeset viewer.