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