Changeset 199

Show
Ignore:
Timestamp:
09/29/07 18:53:09 (14 months ago)
Author:
zany
Message:

print the reason for failed connect()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/apps/obexftp.c

    r191 r199  
    247247static int cli_connect_uuid(const char *uuid, int uuid_len) 
    248248{ 
    249         int retry; 
     249        int ret, retry; 
    250250 
    251251        if (cli == NULL) { 
     
    268268 
    269269                /* Connect */ 
    270                 if (obexftp_connect_src (cli, src_dev, device, channel, uuid, uuid_len) >= 0) 
     270                ret = obexftp_connect_src(cli, src_dev, device, channel, uuid, uuid_len); 
     271                if (ret >= 0) 
    271272                        return TRUE; 
     273                switch (errno) { 
     274                 
     275                case ETIMEDOUT: 
     276                        perror("The device may have moved out of range"); 
     277                        break; /* retry */ 
     278 
     279                case ECONNREFUSED: 
     280                        perror("The user may have rejected the transfer"); 
     281                        return FALSE; 
     282 
     283                case EHOSTDOWN: 
     284                        perror("The device may be out of range or turned off"); 
     285                        break; /* retry */ 
     286 
     287                case EINPROGRESS: 
     288                        perror("Interupted/bad reception or the device moved out of range"); 
     289                        break; /* retry */ 
     290 
     291                default: 
     292                        perror("error on connect()"); 
     293                        break; 
     294                }  
     295 
    272296                fprintf(stderr, "Still trying to connect\n"); 
    273297        }