Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/generic/packet_client.c

    r6b82009 r28a3e74  
    247247}
    248248
    249 /** Return the packet copy.
    250  *
    251  * Copy the addresses, data, order and metric values.
    252  * Queue placement is not copied.
    253  *
    254  * @param[in] sess   Packet server module session.
    255  * @param[in] packet Original packet.
    256  *
    257  * @return Packet copy.
    258  * @return NULL on error.
    259  *
    260  */
    261 packet_t *packet_get_copy(async_sess_t *sess, packet_t *packet)
    262 {
    263         if (!packet_is_valid(packet))
    264                 return NULL;
    265        
     249/** Returns the packet copy.
     250 *
     251 * Copies the addresses, data, order and metric values.
     252 * Does not copy the queue placement.
     253 *
     254 * @param[in] phone     The packet server module phone.
     255 * @param[in] packet    The original packet.
     256 * @return              The packet copy.
     257 * @return              NULL on error.
     258 */
     259packet_t *packet_get_copy(int phone, packet_t *packet)
     260{
     261        packet_t *copy;
     262        uint8_t * src = NULL;
     263        uint8_t * dest = NULL;
     264        size_t addrlen;
     265
     266        if (!packet_is_valid(packet))
     267                return NULL;
     268
    266269        /* Get a new packet */
    267         packet_t *copy = packet_get_4_remote(sess, PACKET_DATA_LENGTH(packet),
     270        copy = packet_get_4_remote(phone, PACKET_DATA_LENGTH(packet),
    268271            PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix,
    269272            PACKET_MIN_SUFFIX(packet));
    270        
    271273        if (!copy)
    272274                return NULL;
    273        
     275
    274276        /* Get addresses */
    275         uint8_t *src = NULL;
    276         uint8_t *dest = NULL;
    277         size_t addrlen = packet_get_addr(packet, &src, &dest);
    278        
     277        addrlen = packet_get_addr(packet, &src, &dest);
    279278        /* Copy data */
    280279        if ((packet_copy_data(copy, packet_get_data(packet),
     
    287286                return copy;
    288287        } else {
    289                 pq_release_remote(sess, copy->packet_id);
     288                pq_release_remote(phone, copy->packet_id);
    290289                return NULL;
    291290        }
Note: See TracChangeset for help on using the changeset viewer.