Changes in uspace/srv/net/tl/tcp/tcp.c [14f1db0:849ed54] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/tcp/tcp.c
r14f1db0 r849ed54 51 51 #include <adt/dynamic_fifo.h> 52 52 #include <packet/packet_client.h> 53 #include <packet_remote.h>54 53 #include <net_checksum.h> 55 54 #include <in.h> … … 69 68 #include <tl_common.h> 70 69 #include <tl_messages.h> 71 #include <tl_local.h>72 #include <tl_interface.h>73 70 74 71 #include "tcp.h" … … 424 421 break; 425 422 default: 426 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));423 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 427 424 } 428 425 … … 476 473 // release the acknowledged packets 477 474 next_packet = pq_next(packet); 478 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));475 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 479 476 packet = next_packet; 480 477 offset -= length; … … 520 517 next_packet = pq_next(next_packet); 521 518 pq_insert_after(tmp_packet, next_packet); 522 pq_release _remote(tcp_globals.net_phone, packet_get_id(tmp_packet));519 pq_release(tcp_globals.net_phone, packet_get_id(tmp_packet)); 523 520 } 524 521 assert(new_sequence_number + total_length == socket_data->next_incoming + socket_data->window); … … 551 548 socket_data->incoming = next_packet; 552 549 } 553 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));550 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 554 551 packet = next_packet; 555 552 continue; … … 571 568 if(length <= 0){ 572 569 // remove the empty packet 573 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));570 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 574 571 packet = next_packet; 575 572 continue; … … 598 595 } 599 596 // remove the duplicit or corrupted packet 600 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));597 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 601 598 packet = next_packet; 602 599 continue; … … 620 617 if(ERROR_OCCURRED(pq_add(&socket_data->incoming, packet, new_sequence_number, length))){ 621 618 // remove the corrupted packets 622 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));623 pq_release _remote(tcp_globals.net_phone, packet_get_id(next_packet));619 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 620 pq_release(tcp_globals.net_phone, packet_get_id(next_packet)); 624 621 }else{ 625 622 while(next_packet){ … … 629 626 if(ERROR_OCCURRED(pq_set_order(next_packet, new_sequence_number, length)) 630 627 || ERROR_OCCURRED(pq_insert_after(packet, next_packet))){ 631 pq_release _remote(tcp_globals.net_phone, packet_get_id(next_packet));628 pq_release(tcp_globals.net_phone, packet_get_id(next_packet)); 632 629 } 633 630 next_packet = tmp_packet; … … 637 634 printf("unexpected\n"); 638 635 // release duplicite or restricted 639 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));636 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 640 637 } 641 638 … … 682 679 // queue the received packet 683 680 if(ERROR_OCCURRED(dyn_fifo_push(&socket->received, packet_get_id(packet), SOCKET_MAX_RECEIVED_SIZE)) 684 681 || ERROR_OCCURRED(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension))){ 685 682 return tcp_release_and_return(packet, ERROR_CODE); 686 683 } … … 713 710 next_packet = pq_detach(packet); 714 711 if(next_packet){ 715 pq_release _remote(tcp_globals.net_phone, packet_get_id(next_packet));712 pq_release(tcp_globals.net_phone, packet_get_id(next_packet)); 716 713 } 717 714 // trim if longer than the header … … 783 780 free(socket_data->addr); 784 781 free(socket_data); 785 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));782 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 786 783 return ERROR_CODE; 787 784 } … … 849 846 next_packet = pq_detach(packet); 850 847 if(next_packet){ 851 pq_release _remote(tcp_globals.net_phone, packet_get_id(next_packet));848 pq_release(tcp_globals.net_phone, packet_get_id(next_packet)); 852 849 } 853 850 // trim if longer than the header … … 898 895 899 896 socket_data->next_incoming = ntohl(header->sequence_number);// + 1; 900 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));897 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 901 898 socket_data->state = TCP_SOCKET_ESTABLISHED; 902 899 listening_socket = socket_cores_find(socket_data->local_sockets, socket_data->listening_socket_id); … … 984 981 // add to acknowledged or release 985 982 if(pq_add(&acknowledged, packet, 0, 0) != EOK){ 986 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));983 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 987 984 } 988 985 packet = next; … … 993 990 // release acknowledged 994 991 if(acknowledged){ 995 pq_release _remote(tcp_globals.net_phone, packet_get_id(acknowledged));992 pq_release(tcp_globals.net_phone, packet_get_id(acknowledged)); 996 993 } 997 994 return; … … 1009 1006 } 1010 1007 1011 int tcp_message _standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){1008 int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ 1012 1009 ERROR_DECLARE; 1013 1010 … … 1022 1019 case NET_TL_RECEIVED: 1023 1020 //fibril_rwlock_read_lock(&tcp_globals.lock); 1024 if(! ERROR_OCCURRED(packet_translate _remote(tcp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){1021 if(! ERROR_OCCURRED(packet_translate(tcp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){ 1025 1022 ERROR_CODE = tcp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_TCP, IPC_GET_ERROR(call)); 1026 1023 } … … 1114 1111 fibril_rwlock_write_unlock(&lock); 1115 1112 if(res == EOK){ 1116 if 1113 if(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){ 1117 1114 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size)); 1118 1115 } … … 1568 1565 }else{ 1569 1566 if(ERROR_OCCURRED(pq_insert_after(previous, copy))){ 1570 pq_release _remote(tcp_globals.net_phone, packet_get_id(copy));1567 pq_release(tcp_globals.net_phone, packet_get_id(copy)); 1571 1568 return sending; 1572 1569 } … … 1600 1597 // adjust the pseudo header 1601 1598 if(ERROR_OCCURRED(ip_client_set_pseudo_header_data_length(socket_data->pseudo_header, socket_data->headerlen, packet_get_data_length(packet)))){ 1602 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));1599 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 1603 1600 return NULL; 1604 1601 } … … 1607 1604 header = (tcp_header_ref) packet_get_data(packet); 1608 1605 if(! header){ 1609 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));1606 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 1610 1607 return NULL; 1611 1608 } … … 1628 1625 // prepare the timeout 1629 1626 || ERROR_OCCURRED(tcp_prepare_timeout(tcp_timeout, socket, socket_data, sequence_number, socket_data->state, socket_data->timeout, true))){ 1630 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));1627 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 1631 1628 return NULL; 1632 1629 } … … 1753 1750 return NO_DATA; 1754 1751 } 1755 ERROR_PROPAGATE(packet_translate _remote(tcp_globals.net_phone, &packet, packet_id));1752 ERROR_PROPAGATE(packet_translate(tcp_globals.net_phone, &packet, packet_id)); 1756 1753 1757 1754 // reply the packets … … 1760 1757 // release the packet 1761 1758 dyn_fifo_pop(&socket->received); 1762 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));1759 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 1763 1760 // return the total length 1764 1761 return (int) length; … … 1892 1889 ERROR_PROPAGATE(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension)); 1893 1890 // get a new packet 1894 *packet = packet_get_4 _remote(tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix);1891 *packet = packet_get_4(tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix); 1895 1892 if(! * packet){ 1896 1893 return ENOMEM; … … 1996 1993 1997 1994 int tcp_release_and_return(packet_t packet, int result){ 1998 pq_release _remote(tcp_globals.net_phone, packet_get_id(packet));1995 pq_release(tcp_globals.net_phone, packet_get_id(packet)); 1999 1996 return result; 2000 1997 } 1998 1999 #ifdef CONFIG_NETWORKING_modular 2000 2001 #include <tl_standalone.h> 2001 2002 2002 2003 /** Default thread for new connections. … … 2026 2027 2027 2028 /* Process the message */ 2028 int res = tl_module_message_standalone(callid, &call, &answer, 2029 &answer_count); 2029 int res = tl_module_message(callid, &call, &answer, &answer_count); 2030 2030 2031 2031 /* End if said to either by the message or the processing result */ … … 2051 2051 ERROR_DECLARE; 2052 2052 2053 /* Print the module label */ 2054 printf("Task %d - %s\n", task_get_id(), NAME); 2055 2053 2056 /* Start the module */ 2054 if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection))) 2057 if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) { 2058 printf(" - ERROR %i\n", ERROR_CODE); 2055 2059 return ERROR_CODE; 2060 } 2056 2061 2057 2062 return EOK; 2058 2063 } 2059 2064 2065 #endif /* CONFIG_NETWORKING_modular */ 2066 2060 2067 /** @} 2061 2068 */
Note:
See TracChangeset
for help on using the changeset viewer.