Changeset 0cab388


Ignore:
Timestamp:
2008-04-14T15:33:13Z (17 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
4358b10
Parents:
b79308b
Message:

more verbose error reporting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dcc.c

    rb79308b r0cab388  
    218218        file_transfer_t *file = df->ft;
    219219        struct sockaddr_storage *saddr;
    220         int fd;
     220        int fd,gret;
    221221        char hostname[ HOST_NAME_MAX + 1 ];
    222222        struct addrinfo hints, *rp;
     
    231231        hints.ai_flags = AI_NUMERICSERV;
    232232
    233         if ( getaddrinfo( hostname, "0", &hints, &rp ) != 0 )
    234                 return dcc_abort( df, "getaddrinfo()" );
     233        if ( ( gret = getaddrinfo( hostname, "0", &hints, &rp ) != 0 ) )
     234                return dcc_abort( df, "getaddrinfo(): %s", gai_strerror( gret ) );
    235235
    236236        saddr = g_new( struct sockaddr_storage, 1 );
     
    390390        struct sockaddr_storage *saddr = &df->saddr;
    391391        int fd;
     392        char ipaddr[INET6_ADDRSTRLEN];
    392393        socklen_t sa_len = saddr->ss_family == AF_INET ?
    393394                sizeof( struct sockaddr_in ) : sizeof( struct sockaddr_in6 );
    394395       
    395396        if( !ft->write )
    396                 return dcc_abort( df, "Protocol didn't register write()" );
     397                return dcc_abort( df, "BUG: protocol didn't register write()" );
    397398       
    398399        ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ) , "Opening Socket" );
     
    402403        if( ( connect( fd, (struct sockaddr *)saddr, sa_len ) == -1 ) &&
    403404            ( errno != EINPROGRESS ) )
    404                 return dcc_abort( df, "Connecting" );
     405                return dcc_abort( df, "Connecting to %s:%d : %s",
     406                        inet_ntop( saddr->ss_family,
     407                                saddr->ss_family == AF_INET ?
     408                                    ( void* ) &( ( struct sockaddr_in *) saddr )->sin_addr.s_addr :
     409                                    ( void* ) &( ( struct sockaddr_in6 *) saddr )->sin6_addr.s6_addr,
     410                                ipaddr,
     411                                sizeof( ipaddr ) ),
     412                        ntohs( saddr->ss_family == AF_INET ?
     413                            ( ( struct sockaddr_in *) saddr )->sin_port :
     414                            ( ( struct sockaddr_in6 *) saddr )->sin6_port ),
     415                        strerror( errno ) );
    405416
    406417        ft->status = FT_STATUS_CONNECTING;
Note: See TracChangeset for help on using the changeset viewer.