Changeset 08042bd in mainline
- Timestamp:
- 2010-11-05T16:34:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 376a7fd
- Parents:
- 60898b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/udp/udp.c
r60898b6 r08042bd 626 626 627 627 // get the next received packet 628 packet_id = dyn_fifo_ pop(&socket->received);628 packet_id = dyn_fifo_value(&socket->received); 629 629 if (packet_id < 0) 630 630 return NO_DATA; 631 631 632 632 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); 634 635 return rc; 636 } 635 637 636 638 // get udp header 637 639 data = packet_get_data(packet); 638 if (!data) 640 if (!data) { 641 (void) dyn_fifo_pop(&socket->received); 639 642 return udp_release_and_return(packet, NO_DATA); 643 } 640 644 header = (udp_header_ref) data; 641 645 … … 643 647 result = packet_get_addr(packet, (uint8_t **) &addr, NULL); 644 648 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); 646 651 return udp_release_and_return(packet, rc); 652 } 647 653 *addrlen = (size_t) result; 648 654 649 655 // send the source address 650 656 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); 652 664 return udp_release_and_return(packet, rc); 665 } 653 666 654 667 // trim the header 655 668 rc = packet_trim(packet, UDP_HEADER_SIZE, 0); 656 if (rc != EOK) 669 if (rc != EOK) { 670 (void) dyn_fifo_pop(&socket->received); 657 671 return udp_release_and_return(packet, rc); 672 } 658 673 659 674 // reply the packets 660 675 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); 662 683 return udp_release_and_return(packet, rc); 684 } 685 686 (void) dyn_fifo_pop(&socket->received); 663 687 664 688 // release the packet and return the total length
Note:
See TracChangeset
for help on using the changeset viewer.