Changeset 1a0fb3f8 in mainline for uspace/srv/net/modules.c
- Timestamp:
- 2010-01-04T22:47:30Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ede63e4
- Parents:
- b648ae4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/modules.c
rb648ae4 r1a0fb3f8 41 41 #include <ipc/services.h> 42 42 43 #include <sys/time.h> 44 43 45 #include "err.h" 44 46 #include "modules.h" 45 47 46 /** The time between connect requests .48 /** The time between connect requests in microseconds. 47 49 */ 48 #define MODULE_WAIT_TIME 1000050 #define MODULE_WAIT_TIME ( 10 * 1000 ) 49 51 50 52 int connect_to_service( services_t need ){ 53 return connect_to_service_timeout( need, 0 ); 54 } 55 56 int connect_to_service_timeout( services_t need, suseconds_t timeout ){ 51 57 int phone; 52 58 int res; 53 59 54 //TODO timeout version? 55 res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone ); 56 while(( res < 0 ) || ( phone < 0 )){ 60 while( true ){ 61 res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone ); 62 if(( res >= 0 ) && ( phone >= 0 )){ 63 return phone; 64 } 65 if( timeout > 0 ){ 66 timeout -= MODULE_WAIT_TIME; 67 if( timeout <= 0 ) return ETIMEOUT; 68 } 57 69 usleep( MODULE_WAIT_TIME ); 58 res = async_req_3_5( PHONE_NS, IPC_M_CONNECT_ME_TO, need, 0, 0, NULL, NULL, NULL, NULL, ( ipcarg_t * ) & phone );59 70 } 60 return phone;61 71 } 62 72 63 73 int bind_service( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver ){ 74 return bind_service_timeout( need, arg1, arg2, arg3, client_receiver, 0 ); 75 } 76 77 int bind_service_timeout( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout ){ 64 78 ERROR_DECLARE; 65 79 … … 67 81 ipcarg_t phonehash; 68 82 69 phone = connect_to_service ( need);83 phone = connect_to_service_timeout( need, timeout ); 70 84 if( phone >= 0 ){ 71 85 if( ERROR_OCCURRED( ipc_connect_to_me( phone, arg1, arg2, arg3, & phonehash ))){
Note:
See TracChangeset
for help on using the changeset viewer.