Changeset 40


Ignore:
Timestamp:
Jan 22, 2006, 2:06:42 AM (17 years ago)
Author:
joshe
Message:

More random debug stuff, also actually change the port right away via the gtk prefs.

Location:
branches/oneport
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/oneport/gtk/prefs.c

    r22 r40  
    162162    cf_setpref(PREF_PORT, strnum, NULL);
    163163    g_free(strnum);
    164     /* XXX should I change the port here?  is it even possible? */
    165164
    166165    /* save uselimit pref */
     
    181180    }
    182181
     182    tr_setBindPort(data->tr, gtk_spin_button_get_value_as_int(data->port));
    183183    setlimit(data->tr);
    184184  }
  • branches/oneport/libtransmission/inout.c

    r20 r40  
    391391    {
    392392        /* Should not happen */
    393         tr_err( "readOrWriteBytes: offset out of range" );
     393        tr_err( "readOrWriteBytes: offset out of range (off=%llu files=%i i=%i)",
     394                offset, inf->fileCount, i);
     395        for(i = 0; i < inf->fileCount; i++)
     396          tr_err( "file %i %lld %s", i, inf->files[i].length, inf->files[i].name );
    394397        goto fail;
    395398    }
  • branches/oneport/libtransmission/net.c

    r26 r40  
    134134               sizeof( struct sockaddr_in ) ) )
    135135    {
    136         tr_err( "Could not bind port %d", port );
     136        tr_err( "Could not bind port %d: %s", port, strerror(errno) );
    137137        tr_netClose( s );
    138138        return -1;
  • branches/oneport/libtransmission/tracker.c

    r39 r40  
    359359    if( i >= tc->pos - 18 )
    360360    {
    361         tr_err( "Tracker: no dictionary in answer (%s)",
    362                 tc->tor->info.trackerAddress );
     361        //tr_err( "Tracker: no dictionary in answer (%s)",
     362        //        tc->tor->info.trackerAddress );
    363363        // printf( "%s\n", tc->buf );
    364364        return;
  • branches/oneport/libtransmission/transmission.c

    r39 r40  
    101101    int ii, sock;
    102102
     103    printf("changing port from %i to %i\n", h->bindPort, port);
     104
    103105    if( h->bindPort == port )
    104106      return;
     
    632634    uint8_t     * hash;
    633635#ifdef PORT_DEBUG
    634     int           oldsocket;
     636    int           oldport, oldsocket;
    635637    int           oldPeerCount;
    636638    tr_peer_t   * oldPeers[TR_MAX_PEER_COUNT];
     
    648650
    649651#ifdef PORT_DEBUG
     652    oldport = h->bindPort;
    650653    oldsocket = h->bindSocket;
    651654#endif
     
    678681            if( tr_peerRead( NULL, h->acceptPeers[ii] ) )
    679682            {
    680                 printf( "failed to read from peer on new port\n" );
     683                printf( "failed to read from peer on new port %i\n", h->bindPort );
    681684                tr_peerDestroy( h->fdlimit, h->acceptPeers[ii] );
    682685                goto removePeer;
     
    690693                                     SHA_DIGEST_LENGTH ) )
    691694                    {
    692                         printf( "got peer on new port for \"%s\"\n",
    693                                 h->torrents[jj]->info.name );
     695                        printf( "got peer on new port %i for \"%s\"\n",
     696                                h->bindPort, h->torrents[jj]->info.name );
    694697                        tr_peerAttach( h->torrents[jj], h->acceptPeers[ii] );
    695698                        tr_lockUnlock( &h->torrents[jj]->lock );
     
    698701                    tr_lockUnlock( &h->torrents[jj]->lock );
    699702                }
    700                 printf( "failed to match hash for peer on new port\n" );
     703                printf( "failed to match hash for peer on new port %i\n", h->bindPort );
    701704                tr_peerDestroy( h->fdlimit, h->acceptPeers[ii] );
    702705                goto removePeer;
     
    711714
    712715#ifdef PORT_DEBUG
     716        if( oldsocket != h->bindSocket) {
    713717        /* Check for incoming connections */
    714718        if( oldsocket > -1 &&
     
    734738            if( tr_peerRead( NULL, oldPeers[ii] ) )
    735739            {
    736                 printf( "failed to read from peer on old port\n" );
     740                printf( "failed to read from peer on old port %i\n", oldport );
    737741                tr_peerDestroy( h->fdlimit, oldPeers[ii] );
    738742                goto removeOldPeer;
     
    746750                                     SHA_DIGEST_LENGTH ) )
    747751                    {
    748                         printf( "got peer on old port for \"%s\"\n",
    749                                 h->torrents[jj]->info.name );
     752                        printf( "got peer on old port %i for \"%s\"\n",
     753                                oldport, h->torrents[jj]->info.name );
    750754                        tr_lockUnlock( &h->torrents[jj]->lock );
    751755                        goto removeOldPeer;
     
    753757                    tr_lockUnlock( &h->torrents[jj]->lock );
    754758                }
    755                 printf( "failed to match hash for peer on old port\n" );
     759                printf( "failed to match hash for peer on old port %i\n", oldport );
    756760                tr_peerDestroy( h->fdlimit, oldPeers[ii] );
    757761                goto removeOldPeer;
     
    764768                     ( oldPeerCount - ii ) * sizeof( tr_peer_t * ) );
    765769        }
     770        }
    766771#endif
    767772
  • branches/oneport/libtransmission/utils.h

    r7 r40  
    3030#define tr_inf( a... ) tr_msg( TR_MSG_INF, ## a )
    3131#define tr_dbg( a... ) tr_msg( TR_MSG_DBG, ## a )
    32 void tr_msg  ( int level, char * msg, ... );
     32void tr_msg  ( int level, char * msg, ... ) __attribute__ ((format (printf, 2, 3)));
    3333
    3434int  tr_rand ( int );
Note: See TracChangeset for help on using the changeset viewer.