Changeset bf172825 in mainline
- Timestamp:
- 2011-06-21T22:32:00Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 55091847, f1fae414
- Parents:
- e3a6c45
- Location:
- uspace
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/ping/ping.c
re3a6c45 rbf172825 341 341 config.dest_str, config.size, config.size); 342 342 343 int icmp_phone = icmp_connect_module( ICMP_CONNECT_TIMEOUT);343 int icmp_phone = icmp_connect_module(); 344 344 if (icmp_phone < 0) { 345 345 fprintf(stderr, "%s: Unable to connect to ICMP service (%s)\n", NAME, -
uspace/lib/c/generic/net/icmp_common.c
re3a6c45 rbf172825 45 45 /** Connect to the ICMP module. 46 46 * 47 * @param[in] timeout Connection timeout in microseconds, zero48 * for no timeout.49 *50 47 * @return ICMP module phone on success. 51 * @return ETIMEOUT if the connection timeouted.52 48 * 53 49 */ 54 int icmp_connect_module( suseconds_t timeout)50 int icmp_connect_module(void) 55 51 { 56 return connect_to_service _timeout(SERVICE_ICMP, timeout);52 return connect_to_service(SERVICE_ICMP); 57 53 } 58 54 -
uspace/lib/c/generic/net/modules.c
re3a6c45 rbf172825 114 114 async_client_conn_t client_receiver) 115 115 { 116 return bind_service_timeout(need, arg1, arg2, arg3, client_receiver, 0);117 }118 119 /** Create bidirectional connection with the needed module service and registers120 * the message receiver.121 *122 * @param[in] need The needed module service.123 * @param[in] arg1 The first parameter.124 * @param[in] arg2 The second parameter.125 * @param[in] arg3 The third parameter.126 * @param[in] client_receiver The message receiver.127 * @param[in] timeout The connection timeout in microseconds. No timeout if128 * set to zero (0).129 *130 * @return The phone of the needed service.131 * @return ETIMEOUT if the connection timeouted.132 * @return Other error codes as defined for the ipc_connect_to_me()133 * function.134 *135 */136 int bind_service_timeout(services_t need, sysarg_t arg1, sysarg_t arg2,137 sysarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)138 {139 116 /* Connect to the needed service */ 140 int phone = connect_to_service _timeout(need, timeout);117 int phone = connect_to_service(need); 141 118 if (phone >= 0) { 142 119 /* Request the bidirectional connection */ … … 159 136 int connect_to_service(services_t need) 160 137 { 161 return connect_to_service_timeout(need, 0); 162 } 163 164 /** Connects to the needed module. 165 * 166 * @param[in] need The needed module service. 167 * @param[in] timeout The connection timeout in microseconds. No timeout if 168 * set to zero (0). 169 * @return The phone of the needed service. 170 * @return ETIMEOUT if the connection timeouted. 171 */ 172 int connect_to_service_timeout(services_t need, suseconds_t timeout) 173 { 174 int phone; 175 176 /* If no timeout is set */ 177 if (timeout <= 0) 178 return service_obsolete_connect_blocking(need, 0, 0); 179 180 while (true) { 181 phone = service_obsolete_connect(need, 0, 0); 182 if ((phone >= 0) || (phone != ENOENT)) 183 return phone; 184 185 /* Abort if no time is left */ 186 if (timeout <= 0) 187 return ETIMEOUT; 188 189 /* Wait the minimum of the module wait time and the timeout */ 190 usleep((timeout <= MODULE_WAIT_TIME) ? 191 timeout : MODULE_WAIT_TIME); 192 timeout -= MODULE_WAIT_TIME; 193 } 138 return service_obsolete_connect_blocking(need, 0, 0); 194 139 } 195 140 -
uspace/lib/c/generic/net/socket_client.c
re3a6c45 rbf172825 64 64 /** Maximum waiting sockets queue size. */ 65 65 #define SOCKET_MAX_ACCEPTED_SIZE 0 66 67 /** Default timeout for connections in microseconds. */68 #define SOCKET_CONNECT_TIMEOUT (1 * 1000 * 1000)69 66 70 67 /** … … 289 286 * @return The TCP module phone. 290 287 * @return Other error codes as defined for the 291 * bind_service _timeout() function.288 * bind_service() function. 292 289 */ 293 290 static int socket_get_tcp_phone(void) 294 291 { 295 292 if (socket_globals.tcp_phone < 0) { 296 socket_globals.tcp_phone = bind_service_timeout(SERVICE_TCP, 297 0, 0, SERVICE_TCP, socket_connection, 298 SOCKET_CONNECT_TIMEOUT); 293 socket_globals.tcp_phone = bind_service(SERVICE_TCP, 294 0, 0, SERVICE_TCP, socket_connection); 299 295 } 300 296 … … 308 304 * @return The UDP module phone. 309 305 * @return Other error codes as defined for the 310 * bind_service _timeout() function.306 * bind_service() function. 311 307 */ 312 308 static int socket_get_udp_phone(void) 313 309 { 314 310 if (socket_globals.udp_phone < 0) { 315 socket_globals.udp_phone = bind_service_timeout(SERVICE_UDP, 316 0, 0, SERVICE_UDP, socket_connection, 317 SOCKET_CONNECT_TIMEOUT); 311 socket_globals.udp_phone = bind_service(SERVICE_UDP, 312 0, 0, SERVICE_UDP, socket_connection); 318 313 } 319 314 … … 397 392 * @return Other error codes as defined for the NET_SOCKET message. 398 393 * @return Other error codes as defined for the 399 * bind_service _timeout() function.394 * bind_service() function. 400 395 */ 401 396 int socket(int domain, int type, int protocol) -
uspace/lib/c/include/net/icmp_common.h
re3a6c45 rbf172825 41 41 #include <sys/time.h> 42 42 43 /** Default timeout for incoming connections in microseconds (1 sec). */ 44 #define ICMP_CONNECT_TIMEOUT 1000000 45 46 extern int icmp_connect_module(suseconds_t); 43 extern int icmp_connect_module(void); 47 44 48 45 #endif -
uspace/lib/c/include/net/modules.h
re3a6c45 rbf172825 58 58 extern int bind_service(services_t, sysarg_t, sysarg_t, sysarg_t, 59 59 async_client_conn_t); 60 extern int bind_service_timeout(services_t, sysarg_t, sysarg_t, sysarg_t,61 async_client_conn_t, suseconds_t);62 60 extern int connect_to_service(services_t); 63 extern int connect_to_service_timeout(services_t, suseconds_t);64 61 extern int data_reply(void *, size_t); 65 62 extern void refresh_answer(ipc_call_t *, size_t *); -
uspace/srv/net/tl/tcp/tcp.c
re3a6c45 rbf172825 2483 2483 tcp_globals.net_phone = net_phone; 2484 2484 2485 tcp_globals.icmp_phone = icmp_connect_module( ICMP_CONNECT_TIMEOUT);2485 tcp_globals.icmp_phone = icmp_connect_module(); 2486 2486 tcp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_TCP, 2487 2487 SERVICE_TCP, tcp_receiver); -
uspace/srv/net/tl/udp/udp.c
re3a6c45 rbf172825 396 396 udp_globals.net_phone = net_phone; 397 397 398 udp_globals.icmp_phone = icmp_connect_module( ICMP_CONNECT_TIMEOUT);398 udp_globals.icmp_phone = icmp_connect_module(); 399 399 400 400 udp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_UDP,
Note:
See TracChangeset
for help on using the changeset viewer.