Changeset 2e99277 in mainline
- Timestamp:
- 2010-02-23T22:51:49Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aa85487
- Parents:
- 8edacbc
- Location:
- uspace/srv/net
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/module.c
r8edacbc r2e99277 110 110 res = module_message( callid, & call, & answer, & answer_count ); 111 111 112 if( IPC_GET_METHOD( call ) == IPC_M_PHONE_HUNGUP ) return; 112 if(( IPC_GET_METHOD( call ) == IPC_M_PHONE_HUNGUP ) || ( res == EHANGUP )){ 113 return; 114 } 113 115 114 116 answer_call( callid, res, & answer, answer_count ); -
uspace/srv/net/tl/icmp/icmp.c
r8edacbc r2e99277 658 658 ipc_callid_t data_callid; 659 659 icmp_echo_ref echo_data; 660 int res; 660 661 661 662 /* … … 663 664 * - Answer the first NET_ICMP_INIT call. 664 665 */ 665 ipc_answer_0( callid, EOK ); 666 res = EOK; 667 answer_count = 0; 666 668 667 669 // fibril_rwlock_initialize( & lock ); … … 669 671 echo_data = ( icmp_echo_ref ) malloc( sizeof( * echo_data )); 670 672 if( ! echo_data ) return ENOMEM; 673 671 674 // assign a new identifier 672 675 fibril_rwlock_write_lock( & icmp_globals.lock ); 673 ERROR_CODE= icmp_bind_free_id( echo_data );676 res = icmp_bind_free_id( echo_data ); 674 677 fibril_rwlock_write_unlock( & icmp_globals.lock ); 675 if( ERROR_CODE< 0 ){678 if( res < 0 ){ 676 679 free( echo_data ); 677 return ERROR_CODE;680 return res; 678 681 } 679 682 680 683 while( keep_on_going ){ 684 685 // answer the call 686 answer_call( callid, res, & answer, answer_count ); 687 688 // refresh data 681 689 refresh_answer( & answer, & answer_count ); 682 690 691 // get the next call 683 692 callid = async_get_call( & call ); 684 693 694 // process the call 685 695 switch( IPC_GET_METHOD( call )){ 686 696 case IPC_M_PHONE_HUNGUP: 687 697 keep_on_going = false; 688 ERROR_CODE = EOK;698 res = EHANGUP; 689 699 break; 690 700 case NET_ICMP_ECHO: 691 701 // fibril_rwlock_write_lock( & lock ); 692 702 if( ! async_data_write_receive( & data_callid, & length )){ 693 ERROR_CODE= EINVAL;703 res = EINVAL; 694 704 }else{ 695 705 addr = malloc( length ); 696 706 if( ! addr ){ 697 ERROR_CODE= ENOMEM;707 res = ENOMEM; 698 708 }else{ 699 709 if( ! ERROR_OCCURRED( async_data_write_finalize( data_callid, addr, length ))){ 700 710 fibril_rwlock_write_lock( & icmp_globals.lock ); 701 ERROR_CODE= icmp_echo( echo_data->identifier, echo_data->sequence_number, ICMP_GET_SIZE( call ), ICMP_GET_TIMEOUT( call ), ICMP_GET_TTL( call ), ICMP_GET_TOS( call ), ICMP_GET_DONT_FRAGMENT( call ), addr, ( socklen_t ) length );711 res = icmp_echo( echo_data->identifier, echo_data->sequence_number, ICMP_GET_SIZE( call ), ICMP_GET_TIMEOUT( call ), ICMP_GET_TTL( call ), ICMP_GET_TOS( call ), ICMP_GET_DONT_FRAGMENT( call ), addr, ( socklen_t ) length ); 702 712 fibril_rwlock_write_unlock( & icmp_globals.lock ); 703 713 free( addr ); … … 707 717 echo_data->sequence_number = 0; 708 718 } 719 }else{ 720 res = ERROR_CODE; 709 721 } 710 722 } … … 713 725 break; 714 726 default: 715 ERROR_CODE= icmp_process_message( & call );727 res = icmp_process_message( & call ); 716 728 } 717 718 answer_call( callid, ERROR_CODE, & answer, answer_count );719 729 } 720 730 … … 723 733 icmp_echo_data_exclude( & icmp_globals.echo_data, echo_data->identifier ); 724 734 fibril_rwlock_write_unlock( & icmp_globals.lock ); 725 return EOK;735 return res; 726 736 } 727 737 -
uspace/srv/net/tl/tcp/tcp.c
r8edacbc r2e99277 1070 1070 * - Answer the first IPC_M_CONNECT_ME_TO call. 1071 1071 */ 1072 ipc_answer_0( callid, EOK ); 1072 res = EOK; 1073 answer_count = 0; 1073 1074 1074 1075 socket_cores_initialize( & local_sockets ); … … 1076 1077 1077 1078 while( keep_on_going ){ 1079 1080 // answer the call 1081 answer_call( callid, res, & answer, answer_count ); 1082 1078 1083 // refresh data 1079 1084 refresh_answer( & answer, & answer_count ); 1080 1085 1086 // get the next call 1081 1087 callid = async_get_call( & call ); 1082 // printf( "message %d\n", IPC_GET_METHOD( * call )); 1083 1088 1089 // process the call 1084 1090 switch( IPC_GET_METHOD( call )){ 1085 1091 case IPC_M_PHONE_HUNGUP: 1086 1092 keep_on_going = false; 1087 res = E OK;1093 res = EHANGUP; 1088 1094 break; 1089 1095 case NET_SOCKET: … … 1231 1237 break; 1232 1238 } 1233 1234 // printf( "res = %d\n", res );1235 1236 answer_call( callid, res, & answer, answer_count );1237 1239 } 1238 1240 … … 1273 1275 // TODO release as connection lost 1274 1276 //tcp_refresh_socket_data( socket_data ); 1275 } 1276 // retransmit1277 // TODO enable retransmit1278 //tcp_retransmit_packet( socket, socket_data, timeout->sequence_number );1277 }else{ 1278 // retransmit 1279 tcp_retransmit_packet( socket, socket_data, timeout->sequence_number ); 1280 } 1279 1281 fibril_rwlock_write_unlock( socket_data->local_lock ); 1280 1282 }else{ -
uspace/srv/net/tl/udp/udp.c
r8edacbc r2e99277 390 390 fibril_rwlock_write_unlock( & udp_globals.lock ); 391 391 async_msg_5( socket->phone, NET_SOCKET_RECEIVED, ( ipcarg_t ) socket->socket_id, packet_dimension->content, 0, 0, ( ipcarg_t ) fragments ); 392 /* fibril_rwlock_write_unlock( & udp_globals.lock ); 393 async_msg_5( socket->phone, NET_SOCKET_RECEIVED, ( ipcarg_t ) socket->socket_id, 0, 0, 0, ( ipcarg_t ) fragments ); 394 */ return EOK; 392 return EOK; 395 393 } 396 394 … … 429 427 * - Answer the first IPC_M_CONNECT_TO_ME call. 430 428 */ 431 ipc_answer_0( callid, EOK ); 429 res = EOK; 430 answer_count = 0; 432 431 433 432 // The client connection is only in one fibril and therefore no additional locks are needed. … … 437 436 438 437 while( keep_on_going ){ 438 439 // answer the call 440 answer_call( callid, res, & answer, answer_count ); 441 439 442 // refresh data 440 443 refresh_answer( & answer, & answer_count ); 441 444 445 // get the next call 442 446 callid = async_get_call( & call ); 443 // printf( "message %d\n", IPC_GET_METHOD( * call )); 444 447 448 // process the call 445 449 switch( IPC_GET_METHOD( call )){ 446 450 case IPC_M_PHONE_HUNGUP: 447 451 keep_on_going = false; 448 res = E OK;452 res = EHANGUP; 449 453 break; 450 454 case NET_SOCKET: … … 514 518 break; 515 519 } 516 517 // printf( "res = %d\n", res );518 519 answer_call( callid, res, & answer, answer_count );520 520 } 521 521 … … 523 523 socket_cores_release( udp_globals.net_phone, & local_sockets, & udp_globals.sockets, NULL ); 524 524 525 return EOK;525 return res; 526 526 } 527 527 … … 618 618 header->checksum = 0; 619 619 if( udp_globals.checksum_computing ){ 620 // if( ERROR_OCCURRED( ip_get_route_req( udp_globals.ip_phone, IPPROTO_UDP, addr, addrlen, & device_id, & ip_header, & headerlen ))){ 621 // return udp_release_and_return( packet, ERROR_CODE ); 622 // } 623 if( ERROR_OCCURRED( ip_client_set_pseudo_header_data_length( ip_header, headerlen, total_length + UDP_HEADER_SIZE))){ 620 // update the pseudo header 621 if( ERROR_OCCURRED( ip_client_set_pseudo_header_data_length( ip_header, headerlen, total_length + UDP_HEADER_SIZE ))){ 624 622 free( ip_header ); 625 623 return udp_release_and_return( packet, ERROR_CODE ); 626 624 } 625 // finish the checksum computation 627 626 checksum = compute_checksum( checksum, ip_header, headerlen ); 628 627 checksum = compute_checksum( checksum, ( uint8_t * ) header, sizeof( * header ));
Note:
See TracChangeset
for help on using the changeset viewer.