Changeset 2596


Ignore:
Timestamp:
Aug 2, 2007, 11:33:40 PM (15 years ago)
Author:
charles
Message:

More win32 portability fixes. we now talk to tracker & peers; hash checks work, downloads seem to work. w00t

Location:
trunk/libtransmission
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fastresume.c

    r2573 r2596  
    168168
    169169    fastResumeFileName( path, sizeof path, tor, 1 );
    170     file = fopen( path, "w" );
     170    file = fopen( path, "wb" );
    171171    if( NULL == file ) {
    172172        tr_err( "Couldn't open '%s' for writing", path );
     
    469469    /* Open resume file */
    470470    fastResumeFileName( path, sizeof path, tor, 1 );
    471     file = fopen( path, "r" );
     471    file = fopen( path, "rb" );
    472472    if( !file )
    473473    {
     
    475475        {
    476476            fastResumeFileName( path, sizeof path, tor, 0 );
    477             file = fopen( path, "r" );
     477            file = fopen( path, "rb" );
    478478            if( !file )
    479479            {
  • trunk/libtransmission/fdlimit.c

    r2593 r2596  
    430430    char path[MAX_PATH_LENGTH];
    431431    int ret;
     432    int flags;
    432433
    433434    tr_dbg( "Opening %s in %s (%d)", name, folder, write );
     
    449450        char * s;
    450451
    451         while( ( s = strchr( p, '/' ) ) )
     452        while( ( s = strchr( p, TR_PATH_DELIMITER ) ) )
    452453        {
    453454            *s = '\0';
     
    469470                }
    470471            }
    471             *s = '/';
     472            *s = TR_PATH_DELIMITER;
    472473            p = s + 1;
    473474        }
     
    476477    /* Now try to really open the file */
    477478    errno = 0;
    478     file->file = open( path, write ? ( O_RDWR | O_CREAT ) : O_RDONLY, 0666 );
     479    flags = 0;
     480#ifdef WIN32
     481    flags |= O_BINARY;
     482#endif
     483    flags |= write ? (O_RDWR | O_CREAT) : O_RDONLY;
     484    file->file = open( path, flags, 0666 );
    479485    if( write && ( file->file < 0 ) )
    480486    {
  • trunk/libtransmission/net.c

    r2593 r2596  
    307307    sock.sin_port        = port;
    308308
    309     if( connect( s, (struct sockaddr *) &sock,
    310                  sizeof( struct sockaddr_in ) ) < 0 &&
    311         sockerrno != EINPROGRESS )
     309    if( ( connect( s, (struct sockaddr *) &sock,
     310                   sizeof( struct sockaddr_in ) ) < 0 )
     311#ifdef WIN32
     312        && ( sockerrno != WSAEWOULDBLOCK )
     313#endif
     314        && ( sockerrno != EINPROGRESS ) )
    312315    {
    313316        tr_err( "Couldn't connect socket (%s)", strerror( sockerrno ) );
  • trunk/libtransmission/platform.c

    r2591 r2596  
    749749        {
    750750            tr_err( "sysctl net.route.0.inet.flags.gateway failed (%s)",
    751                     strerror( errno ) );
     751                    strerror( sockerrno ) );
    752752        }
    753753        *buflen = 0;
     
    765765    {
    766766        tr_err( "sysctl net.route.0.inet.flags.gateway failed (%s)",
    767                 strerror( errno ) );
     767                strerror( sockerrno ) );
    768768        free( buf );
    769769        *buflen = 0;
     
    895895    if( 0 > fd )
    896896    {
    897         tr_err( "failed to create routing socket (%s)", strerror( errno ) );
     897        tr_err( "failed to create routing socket (%s)", strerror( sockerrno ) );
    898898        return -1;
    899899    }
     
    902902    if( 0 > flags || 0 > fcntl( fd, F_SETFL, O_NONBLOCK | flags ) )
    903903    {
    904         tr_err( "failed to set socket nonblocking (%s)", strerror( errno ) );
     904        tr_err( "failed to set socket nonblocking (%s)", strerror( sockerrno ) );
    905905        close( fd );
    906906        return -1;
     
    921921                    (struct sockaddr *) &snl, sizeof( snl ) ) )
    922922    {
    923         tr_err( "failed to write to routing socket (%s)", strerror( errno ) );
     923        tr_err( "failed to write to routing socket (%s)", strerror( sockerrno ) );
    924924        close( fd );
    925925        return -1;
  • trunk/libtransmission/utils.c

    r2591 r2596  
    4949static tr_lock_t      * messageLock = NULL;
    5050static int              messageLevel = 0;
    51 static int              messageQueuing = 0;
     51static int              messageQueuing = FALSE;
    5252static tr_msg_list_t *  messageQueue = NULL;
    5353static tr_msg_list_t ** messageQueueTail = &messageQueue;
     
    161161            vfprintf( stderr, msg, args1 );
    162162            fputc( '\n', stderr );
     163            fflush( stderr );
    163164        }
    164165        va_end( args1 );
Note: See TracChangeset for help on using the changeset viewer.