Ignore:
Timestamp:
2010-01-04T22:47:30Z (16 years ago)
Author:
Lukas Mejdrech <lukasmejdrech@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ede63e4
Parents:
b648ae4
Message:

+ icmp and libsocket timeouting connecting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/socket/socket_client.c

    rb648ae4 r1a0fb3f8  
    7171#define SOCKET_MAX_ACCEPTED_SIZE                0
    7272
     73/** Default timeout for connections in microseconds.
     74 */
     75#define SOCKET_CONNECT_TIMEOUT  ( 1 * 1000 * 1000 )
     76
    7377/** Type definition of the socket specific data.
    7478 *  @see socket
     
    180184 *  Connects to the TCP module if necessary.
    181185 *  @returns The TCP module phone.
     186 *  @returns Other error codes as defined for the bind_service_timeout() function.
    182187 */
    183188static int      socket_get_tcp_phone( void );
     
    186191 *  Connects to the UDP module if necessary.
    187192 *  @returns The UDP module phone.
     193 *  @returns Other error codes as defined for the bind_service_timeout() function.
    188194 */
    189195static int      socket_get_udp_phone( void );
     
    262268static int socket_get_tcp_phone( void ){
    263269        if( socket_globals.tcp_phone < 0 ){
    264                 socket_globals.tcp_phone = bind_service( SERVICE_TCP, 0, 0, SERVICE_TCP, socket_connection );
     270                socket_globals.tcp_phone = bind_service_timeout( SERVICE_TCP, 0, 0, SERVICE_TCP, socket_connection, SOCKET_CONNECT_TIMEOUT );
    265271        }
    266272        return socket_globals.tcp_phone;
     
    269275static int socket_get_udp_phone( void ){
    270276        if( socket_globals.udp_phone < 0 ){
    271                 socket_globals.udp_phone = bind_service( SERVICE_UDP, 0, 0, SERVICE_UDP, socket_connection );
     277                socket_globals.udp_phone = bind_service_timeout( SERVICE_UDP, 0, 0, SERVICE_UDP, socket_connection, SOCKET_CONNECT_TIMEOUT );
    272278        }
    273279        return socket_globals.udp_phone;
     
    426432                        return EPFNOSUPPORT;
    427433        }
     434        if( phone < 0 ) return phone;
    428435        // create a new socket structure
    429436        socket = ( socket_ref ) malloc( sizeof( socket_t ));
Note: See TracChangeset for help on using the changeset viewer.